標籤:style blog class code java c
匯出apk,是不能用電影紋理的,所以我們只能用這個辦法
這個
Handheld.PlayFullScreenMovie();
或者這個函數
iPhoneUtils.PlayMovie();
void OnGUI() { if (GUI.Button(new Rect(Screen.width / 2 - 10, Screen.height / 2 - 10, 100,20), "(h)CancelOnTouch")) { Handheld.PlayFullScreenMovie("123.mp4", Color.black, FullScreenMovieControlMode.CancelOnInput); } if (GUI.Button(new Rect(Screen.width / 2 - 10, Screen.height / 2 + 10, 100, 20), "(h)Full")) { Handheld.PlayFullScreenMovie("123.mp4", Color.black, FullScreenMovieControlMode.Full); } if (GUI.Button(new Rect(Screen.width / 2 - 10, Screen.height / 2 + 30, 100, 20), "(h)Hidden")) { Handheld.PlayFullScreenMovie("123.mp4", Color.black, FullScreenMovieControlMode.Hidden); } if (GUI.Button(new Rect(Screen.width / 2 - 10, Screen.height / 2 + 50, 100, 20), "(h)Minimal")) { Handheld.PlayFullScreenMovie("123.mp4", Color.black, FullScreenMovieControlMode.Minimal); } }
FullScreenMovieControlMode有四種模式,
1.視頻播放時觸控螢幕幕視頻關閉
2.視頻播放時彈出IOS進階控制項,控制視頻暫停播放 全屏等等。
3.視頻播放時無法停止,當其播放完一次後自動關閉
4.視頻播放時彈出IOS進階控制項,可控制播放進度。
四種模式
iPhoneUtils.PlayMovie();
也是一樣
void OnGUI() { if (GUI.Button(new Rect(Screen.width / 2 - 110, Screen.height / 2 - 10, 100, 20), "(i)CancelOnTouch")) { iPhoneUtils.PlayMovie("123.mp4", Color.black, iPhoneMovieControlMode.CancelOnTouch, iPhoneMovieScalingMode.AspectFit); } if (GUI.Button(new Rect(Screen.width / 2 - 110, Screen.height / 2 + 10, 100, 20), "(i)Full")) { iPhoneUtils.PlayMovie("123.mp4", Color.black, iPhoneMovieControlMode.Full, iPhoneMovieScalingMode.AspectFit); } if (GUI.Button(new Rect(Screen.width / 2 - 110, Screen.height / 2 + 30, 100, 20), "(i)Hidden")) { iPhoneUtils.PlayMovie("123.mp4", Color.black, iPhoneMovieControlMode.Hidden, iPhoneMovieScalingMode.AspectFit); } if (GUI.Button(new Rect(Screen.width / 2 - 110, Screen.height / 2 + 50, 100, 20), "(i)Minimal")) { iPhoneUtils.PlayMovie("123.mp4", Color.black, iPhoneMovieControlMode.Minimal, iPhoneMovieScalingMode.AspectFit); } }
iPhoneMovieControlMode的方法已經過時,可以換成FullScreenMovieControlMode
iPhoneMovieScalingMode就是調scale的模式,設為null就行。
照常理這樣就可以播放了,
但是又遇到了另一個問題
不播放視頻,一片漆黑,但是顯示著最終時間
這個就是手機解析度的問題,切記解析度(GAME面板中)一定要和手機設定的一樣,否則就不會播放