Whoever uses the Easy Movie Texture For Android (Video Texture) version 2.18 and also uses split apks (obbs) in unity might run into problems with the streaming asset sub-folders. It’s a great plugin to handle rendered textures on mobile devices.
However the plugin fails to create sub-directories while copying videos out of the obbs into their respective sub-folders. Which can fixed by adding
1 | Directory.CreateDirectory(Directory.GetParent(write_path).FullName); |
in the MediaPlayerCtrl.CopyStreamingAssetVideoAndLoad.
So it looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | IEnumerator CopyStreamingAssetVideoAndLoad(string strURL) { strURL = strURL.Trim(); string write_path = Application.persistentDataPath + "/" + strURL; if(System.IO.File.Exists(write_path) == false) { Debug.Log ("CopyStreamingAssetVideoAndLoad : " + strURL); Directory.CreateDirectory(Directory.GetParent(write_path).FullName); WWW www = new WWW(Application.streamingAssetsPath +"/"+ strURL); yield return www; if( string.IsNullOrEmpty(www.error)) { Debug.Log (write_path); System.IO.File.WriteAllBytes(write_path, www.bytes ); Call_Load("file://"+write_path,0); } else { Debug.Log(www.error); } www.Dispose(); www = null; } else { Call_Load("file://"+write_path,0); } } |
Also in order to have a e.g. complete callback, simply add a
1 | public event Action OnFinished; |
in the same class and call them at the respective m_CurrentState checks:
1 2 3 | else if(m_CurrentState == MEDIAPLAYER_STATE.END) if(OnFinished != null) OnFinished(); |
I’ve already e-mailed the fix to Lee JaeYun and it will be fixed in a later version presumably, until then use the fix and enjoy.
February 10, 2015 at 7:16 pm
Hi, can I ask you how did you actually play a video (with Easy Movie Texture) stored in the streamingassets folder? To me it works only when Unity creates a single apk. When I use the Split Application Binary option, the video doesn’t play anymore… I have to change the path of the video file in the Inspector?
June 24, 2015 at 3:26 pm
you can unzipp the obb and check if the video is there, if so, then the path to open it might need to be adapted
October 24, 2015 at 3:07 pm
逆向直销,震撼来袭:
优势①:逆向网赚,真正实现就算什么不干都赚钱
优势②:十级提成,下线年年续费,上线年年收钱
优势③:静态分红,每日签到就有钱,封顶一百元
优势④:百万资源,每日更新,一键转存无限下载
优势⑤:强大网站,八个栏目,无限发布产品广告
免费注册地址:
http://www.629494567.9489988.com/
April 6, 2016 at 5:03 am
不错,不错,看看了!
April 19, 2016 at 9:37 am
看看!
June 17, 2016 at 3:02 am
年中快乐!
December 12, 2016 at 2:04 am
今天真冷,哈哈!
May 14, 2017 at 10:40 am
受教了!呵呵!