- Home /
Android Split APK-OBB and StreamingAssets
Hi Guys!
Here is my S.O.S. call:
I have an app that I made for a Tourism manager, so basically is a 360° Video Player which have 4 scenes:
– Splashscreen scene with my company name on it (this just last 5 seconds)
– A menu scene where you can pick a 2d or 3d scene
– the 2d scene
– the 3d scene (stereoscopic view)
So I’m using the EasyMovieTexture asset to put my 360 video on a sphere and everything runs perfect in the full apk (230mb) when I install it on the test phone (samsung s5). Off course my .mp4 file is in the StremingAssets folder and there´s no problem with the playback.
The BIG PROBLEM comes when I upload the app to the Google playstore. I just did it throught the regular way:
– Using the Split Application Binary
– Uploading the apk (17mb)
– Then uploading the obb (213mb) which name is changed automatically by the playstore to “main.x.x.x.obb”
Now, when the app is downloaded throught the playstore both files are downloaded (I can see the .obb file in the /Android/obb/com.x.x/ folder) but the thing is that it seems that the app is loading it from another location because there is no video playback. However the scene that contains the video is loaded. So, I think that there is an issue with the reading of the .mp4 file wich is in the streamingassets folder, but I can’t make the EasyMovieTexture to look at the OBB file.
Here is a script made by Jon Martin wich is trying to fix this issue by correcting the path where the MoviePlayerCtrl has to look for the movie file
public string CorrectMoviePath(string filename) {
if (Application.dataPath.Contains(".obb")) {
filename = Application.persistentDataPath + "/" + filename
} else {
filename = Application.streamingAssetsPath + "/" + filename
}
return filename;
}
So now my question is, Where do I have to put this to make this work. I now is in the MoviePLayerCtrl script but it is too large and by just put it in there doest fix the problem and when I try to add the movie file name into the script Unity shows an error saying that the value doesnt exist.
Any help would be awesome!
Thnks in advance!
Regards from Chile!
Hi! I'm having the exact same issue. Have you made any progress with this?
Thanks!
Steve
Hi I'm running into this problem right now. Everything was working before but after I added Prime31's Google Play Store kit and implemented my IAP it stopped working. So far I've narrowed it down to the following.
If I don't split application binary. It loads the video from jar:file:///data/app/com.company.appname.apk!/assets
If I split the application binary, it tries to load from jar:file:///storage/emulated/0/Android/obb/com.company.appname /main.version.com.company.appname.obb!/assets
Without splitting the binary, the videos load fine but splitting it seems to break the link. I've read in some places that it is the result of mixing javascript and C# but as far as I can tell the files in my source are all C#. I will try to update if I make any meaningful progress
Hi I'm running into this problem right now. Everything was working before but after I added Prime31's Google Play Store kit and implemented my IAP it stopped working. So far I've narrowed it down to the following.
If I don't split application binary. It loads the video from jar:file:///data/app/com.company.appname.apk!/assets
If I split the application binary, it tries to load from jar:file:///storage/emulated/0/Android/obb/com.company.appname /main.version.com.company.appname.obb!/assets
Without splitting the binary, the videos load fine but splitting it seems to break the link. I've read in some places that it is the result of mixing javascript and C# but as far as I can tell the files in my source are all C#. I will try to update if I make any meaningful progress
Hola @daro1nsan3 , aprovecho que eres de chile para preguntarte en español jeje. pudiste solucionar el problema con los videos? me sería de mucha ayuda. Ando revisando ya varios días y no logro hacer que funcione, los modelos 3d los carga normal, pero no logro hacer que funcione los videos. Gracias
Hey, sorry for bumping such an old thread, but did you find any solution ?
I’ve moved onto using U$$anonymous$$P or the new unity video player. Both work better in unity 2017.2
Hello and thank you for the fast answer. How exactly do you use the new video player ? What i do is create a VideoPlayer named videoPlayer, set videoPlayer.url to the path of the video and then use videoPlayer.Prepare(). When it's done I use videoPlayer.Play() and it plays the video(only on PC and apk-only builds, I still didn't manage to find the path to the video in the obb or what to do). Thanks a lot.
Answer by wywarren · May 20, 2015 at 02:15 PM
I think I've found the solution. Enter MediaPlayerCtrl.cs and go down into the first ANDROID block and change it to the following:
if(m_bSupportRockchip)
{
Call_SetRockchip(m_bSupportRockchip);
if(strName.Contains("://"))
{
Call_Load(strName,0);
}
else
{
//Call_Load(strName,0);
StartCoroutine( CopyStreamingAssetVideoAndLoad(strName));
}
}
else
{
//Call_Load(strName,0);
StartCoroutine( CopyStreamingAssetVideoAndLoad(strName));
}
More specifically, I commented out the Call_Load function in the else block and loaded the video using the CopyStreamAssetVideoAndLoad and everything is working dandy now.
Couple of things to note:
I suspect this happens because Call_Load tries to load something locally that doesn't exist and CopyStreamingAssetVideoAndLoad actually looks in the streaming assets folder in the OBB and copies it locally a folder the apk can access.
As of version 2.16 of EasyMovieTexture, there is a sample project (package) called in the Scene folder called "Demo_SplitOBB". If you extract the contents and look at the file "MedaiPlayerSampleGUIObb.cs" you will see the way to properly build the URI.
There goes half my day but a solution is a solution and I hope this saves everyone time!