cancel
Showing results for 
Search instead for 
Did you mean: 

Movie Playing in UnitySDK

smx
Honored Guest
In the sample scene "MoviePlayer_Sample" offered by Oculus in the UnitySDK:

I cannot play a movie. Although I changed

mediaPlayer.Call( "setDataSource", "/sdcard/oculus/Movies/Trailers/Night_of_the_living_Dead.mp4" );
to an existing movie it doesn't play the movie.

Also it says: "NOTE: The resolution of the movie texture is hard coded to 960x540 in MediaSurface.cpp."

How can I change that to 4096x2048 video @ 30 FPS or a
2048x2048 video @ 60 FPS as hinted at in the docs.


Thanks!
38 REPLIES 38

HomerS66
Expert Protege
"smx" wrote:

How can I change that to 4096x2048 video @ 30 FPS or a
2048x2048 video @ 60 FPS as hinted at in the docs.



I think those settings are only ment for 360 videos.

smx
Honored Guest
"HomerS66" wrote:
"smx" wrote:

How can I change that to 4096x2048 video @ 30 FPS or a
2048x2048 video @ 60 FPS as hinted at in the docs.



I think those settings are only ment for 360 videos.


Yeah, I want to build my own 360 video player.

eoniantech
Explorer
"smx" wrote:

Also it says: "NOTE: The resolution of the movie texture is hard coded to 960x540 in MediaSurface.cpp."

How can I change that to 4096x2048 video @ 30 FPS or a
2048x2048 video @ 60 FPS as hinted at in the docs.


Thanks!


I think this is done by going into the sdk and modifying MediaSurface.cpp (sdk\VRLib\jni\Integrations\Unity\MediaSurface.cpp). There are two values width and height on line 171 that are hard coded as 960 and 540. Changing these values failed to solve my resolution problems in unity 360 video, however. Let me know if you are able to get anything.

smx
Honored Guest
Regarding my first question: SOLVED

I needed to change the path of the movie to:

"/storage/extSdCard/Oculus/Movies/Trailers/Interstellar.mp4"


However, concerning the second question,

"eoniantech" wrote:
"smx" wrote:

Also it says: "NOTE: The resolution of the movie texture is hard coded to 960x540 in MediaSurface.cpp."

How can I change that to 4096x2048 video @ 30 FPS or a
2048x2048 video @ 60 FPS as hinted at in the docs.


Thanks!


I think this is done by going into the sdk and modifying MediaSurface.cpp (sdk\VRLib\jni\Integrations\Unity\MediaSurface.cpp). There are two values width and height on line 171 that are hard coded as 960 and 540. Changing these values failed to solve my resolution problems in unity 360 video, however. Let me know if you are able to get anything.


I suppose I will need to recoompile the Oculus Plugin.

eoniantech
Explorer
Have you had any success in changing the resolution? If so what are you doing? I've tried re-importing the unity package after setting the dimensions to 2048x2048 with no perceived effect on quality.

smx
Honored Guest
I haven't tried, yet. But others seemed to have your experience.

I would really like to have an official answer on that. Especially because watching movies on the GearVR is such a worthwhile experience.

Hirdannen
Protege
Changing the hard-coded values in the vrlib should work, it worked for me. Are you making a native app or a unity app ? If so, what did you replace in the Unity project ?

cowlinator
Explorer
Which version of the Oculus Mobile SDK are you using?

In my version (0.4.1, 2015/01/06) of sdk\VRLib\jni\Integrations\Unity\MediaSurface.cpp, I see the code:

// FIXME: no way to get texture dimensions even in ES 3.0???
int width = 960;
int height = 540;
if ( width != TexIdWidth || height != TexIdHeight )
{
LOG( "New surface size: %ix%i", width, height );

TexIdWidth = width;
TexIdHeight = height;

...
}

Which, I believe, coerces (stretches) the movie to be 960x540, which is a 16:9 aspect ratio.

MoviePlayerSample.cs works for me with a 1280 x 720 mp4 (also 16:9) and looks good. I didn't modify MediaSurface.cpp.

cowlinator
Explorer
One thing I did notice, is that you have absolutely no control over the movie volume. Even after destroying all AudioListeners in the scene, the movie plays at full volume, meaning that the movie player goes around Unity to do the audio.