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.