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

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


So would these steps work to make a 360 video player in Unity Free? (Still waiting for my Gear VR to test)

-change media dimensions in MediaSurface.cpp
-create a sphere, reverse normals and put camera prefab in the scene
-apply the movieplayersample.cs script and change video location

Hirdannen
Protege
"TheCaravanBand" wrote:
Yeah, I want to build my own 360 video player.


So would these steps work to make a 360 video player in Unity Free? (Still waiting for my Gear VR to test)

-change media dimensions in MediaSurface.cpp
-create a sphere, reverse normals and put camera prefab in the scene
-apply the movieplayersample.cs script and change video location


Yes it would. But you also need to adjust UVs on the video you want to stream, if you have stereo.
For example, given a 3840x1440 stereo video, you would actually need 2 meshes, each one mapped to half the video.
You can test UV mapping quite easily by using a half red, half green 3840x1440 texture on the spheres.

Also be careful from where you want to play the video. From SDcard, no problem. From APK, it's a whole different thing.

Note that MediaPlayer works, of course, only on the phone, since it's a java object. You can't test it on PC

buildmedia
Honored Guest
Anyone experience flickering in right eye but smooth motion in the left? I updated MediaSurface.cpp and recompiled plugin using NDK - the left eye is playing perfectly and the right eye flickers when I move my head. Movie I was testing is 3840x1920.

Hirdannen
Protege
"buildmedia" wrote:
Anyone experience flickering in right eye but smooth motion in the left? I updated MediaSurface.cpp and recompiled plugin using NDK - the left eye is playing perfectly and the right eye flickers when I move my head. Movie I was testing is 3840x1920.


Hmm, weird. Maybe check right eye sphere's UVs and verify that it can only be seen by one eye at the time..

Anonymous
Not applicable
Hey Guys,
I'm also playing around with video in unity for the Gear.
I want to change the video resolution, to do that from what i understand, I need to change the hard coded res in MediaSurface.cpp, which I did.
Now, again from what I understand, I need to recompile the VRLib.jar and re-import it into my unity project.

My question is how do I recompile VRLib.jar? I think I need to use the build.sh file, but how do I do that?
can anyone please take me through the steps?

many thanks

RViana
Explorer
"koel2009" wrote:
Hey Guys,
I'm also playing around with video in unity for the Gear.
I want to change the video resolution, to do that from what i understand, I need to change the hard coded res in MediaSurface.cpp, which I did.
Now, again from what I understand, I need to recompile the VRLib.jar and re-import it into my unity project.

My question is how do I recompile VRLib.jar? I think I need to use the build.sh file, but how do I do that?
can anyone please take me through the steps?

many thanks


Hi!

Same here, trying to recompile VRLib.jar too. to use build.sh u need to use some Terminal on a Mac/Linux,
on windows maybe Powershell. But you got to have the Android development tools required for Native Android development.
See SDK docs for the environment setup. eclipse+ndk+adk


i can build the libOculus.so plugin, but as for VRLib.jar no clue. does anyone been successful at it?

thanks in advance
Ricardo

Hirdannen
Protege
Both should be done at the same time while recompiling the Native VRLib. It worked when I had to do it in September 2014

RViana
Explorer
I get libJavaVr.so and libOculusPlugin.so

but no vrlib.jar ! 😞
maybe it doesn't eve n need it don't know.
Unity player crashes at splash screen.
and get :

E/Unity ( 2715): Unable to find OculusInitPlugin

here is what the terminal spits out on build.sh

========================== Update VRLib Project ===========================
Updated project.properties
Updated local.properties
Updated file ./proguard-project.txt
Updated and renamed default.properties to project.properties
Updated local.properties
No project name specified, using project folder name 'bin'.
If you wish to change it, edit the first line of build.xml.
Added file ./bin/build.xml
Added file ./bin/proguard-project.txt
========================== Build VRLib release ===========================
Android NDK: WARNING: Ignoring unknown import directory: jni/../../3rdParty/libjpeg-turbo
Android NDK: WARNING: Ignoring unknown import directory: jni/../../3rdParty/breakpad/android
[armeabi-v7a] Install : libJavaVr.so => libs/armeabi-v7a/libJavaVr.so
[armeabi-v7a] Install : libOculusPlugin.so => libs/armeabi-v7a/libOculusPlugin.so

leftbigtoe
Protege
hey guys, running in the same issue, no VRLib.jar file is generated.
Was anybody successful in solving this problem?

Hirdannen
Protege
Note: actually since you change only MediaSurface.cpp, you only need the .so file.

As for compiling the VRlib, I managed it through Eclipse a while ago and it still works. I'm no expert on Android development and can't explain much on how to correctly compile it (it wasn't easy for me)