I had some problems trying to play the video through Oculus mobile sdk MediaSurfacePlugin for Unity. I have tried many different ideas, but come back to the same problem; It appears that the Android media player cannot find the file. These are the most common errors I received:
Unity: failed to start mediaPlayer with message java.io.IOException: setDataSource failed.
Unity:
Unity: (File name: ./ artifacts / generated / common / runtime / UnityEngineDebugBindings.gen.cpp Line: 37)
Unity:
and
MediaPlayer: unable to create media player
Unity: failed to start mediaPlayer with message java.io.IOException: setDataSourceFD failed: status = 0x80000000
Unity:
: ( :. /artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp : 37)
:
; . = 0x1.
, , , , - ( , ;.ogv, .mp4).
streamingassets , , ?
; ovr_sdk_mobile_1.0.3 Unity v5.3.6f1, Oculus Utilities v1.7.0, OVRPlugin v1.5.0, SDK v1.0.3.1.
:
- : big_buck_bunny.mp4, .
- / :
, , , , , , , , :
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject context = activity.Call<AndroidJavaObject>("getApplicationContext");
AndroidJavaObject assets = context.Call<AndroidJavaObject>("getAssets");
AndroidJavaObject descriptor = assets.Call<AndroidJavaObject>("openFd", movieName+".ogv");
mediaPlayer.Call("setDataSource", new object[]{descriptor.Call<object>("getFileDescriptor"),descriptor.Call<object>("getStartOffset"),descriptor.Call<object>("getLength")});
sdk readme MediaSurfacePlugin IntPtr androidSurface = OVR_Media_Surface(textureId, 2880, 1440);
, , (?), , , , :
OVR_Media_Surface_SetTextureId(texId);
OVR_Media_Surface_SetTextureParms(960, 540);
IntPtr androidSurface = OVR_Media_Surface_GetObject();
oculus callvoidmethod callobjectmethod, , , :
AndroidJNI.CallObjectMethod(mediaPlayer.GetRawObject(), setSurfaceMethodId, parms);
, Unity Android; , , .
, , !
- ?