建站服务器
theora converter .net转换器会把其他格式转化为ogv格式,直接被unity识别,不需要安装quicktime不需要重启,更为重要的是比把mov导入unity的要清晰。
[csharp]view plaincopy
1.using unityengine;
2.using system.collections;
3.
4.public class movietest : monobehaviour
5.{
6. //电影纹理
7. public movietexture movtexture;
8.
9. void start()
10. {
11. //设置当前对象的主纹理为电影纹理
12. renderer.material.maintexture = movtexture;
13. //设置电影纹理播放模式为循环
14. movtexture.loop = true;
15. //startcoroutine(downloadmovie());
16. }
17.
18. void ongui()
19. {
20. if (guilayout.button(播放/继续))
21. {
22. //播放/继续播放视频
23. if (!movtexture.isplaying)
24. {
25. movtexture.play();
26. }
27. }
28.
29. if (guilayout.button(暂停播放))
30. {
31. //暂停播放
32. movtexture.pause();
33. }
34.
35. if (guilayout.button(停止播放))
36. {
37. //停止播放
38. movtexture.stop();
39. }
40. }
41.
42. ienumerator downloadmovie()
43. {
44. www www = new www(http://127.0.0.1/head.ogv);
45. yield return www;
46. debug.log(time.time);
47. movtexture = www.movie;
48. //设置当前对象的主纹理为电影纹理
49. renderer.material.maintexture = movtexture;
50. movtexture.loop = true;
51. }
52.
53.}
加声音
[csharp]view plaincopy
1.using unityengine;
2.using system.collections;
3.
4.public class movietest : monobehaviour
5.{
6. //电影纹理
7. public movietexture movtexture;
8. //声音
9. public audiosource movaudio;
10.
11. void start()
12. {
13. //设置当前对象的主纹理为电影纹理
14. renderer.material.maintexture = movtexture;
15. //设置电影纹理播放模式为循环
16. movtexture.loop = true;
17. //startcoroutine(downloadmovie());
18. }
19.
20. void ongui()
21. {
22. if (guilayout.button(播放/继续))
23. {
24. //播放/继续播放视频
25. if (!movtexture.isplaying)
26. {
27. movtexture.play();
28. movaudio.play();
29. }
30. }
31.
32. if (guilayout.button(暂停播放))
33. {
34. //暂停播放
35. movtexture.pause();
36. movaudio.pause();
37. }
38.
39. if (guilayout.button(停止播放))
40. {
41. //停止播放
42. movtexture.stop();
43. movaudio.stop();
44. }
45. }
46.
47. ienumerator downloadmovie()
48. {
49. www www = new www(http://127.0.0.1/head.ogv);
50. yield return www;
51. debug.log(time.time);
52. movtexture = www.movie;
53. //设置当前对象的主纹理为电影纹理
54. renderer.material.maintexture = movtexture;
55. movtexture.loop = true;
56. }
57.
58.}
注:1280*720分辨率的视频以此方法播放不会产生黑边。
关于厦门网站建设网站的重要性及步骤的简述网站打开速度太慢-云服务器问题域名已过期如何续费 域名过期后多久会被删除使用云服务器怎么建网站chrome浏览器如何屏蔽广告 chrome屏蔽广告的具体方法制作英文网站需要细心的地方如何选择高端网站建设公司建立一个网站需要几步 域名注册是网站的第一步