Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
martinezj's avatar
martinezj
Honored Guest
8 years ago

Programmatically run mp4 videos with .net SDK

I recently downloaded the sdk wrapper for .net and am having a hard time figuring out how to load mp4 movies programmatically.


Does anyone have sample code that can share?

Thank you,

1 Reply

  • Are you looking to do this in Unity in a virtual reality game/app you are developing specifically? If so, the Oculus samples include an example of how to do this. I'd take a look there to start.

    Edit: Was on mobile before so couldn't post a more detailed response, so here is the exact sample and some details on it:

    You can download the sample from Oculus here: https://developer3.oculus.com/downloads/game-engines/1.11.0/Oculus_Sample_Framework_for_Unity_5_Project/ (if you are seeing this in the future, make sure you check for a newer version)

    It's included under the "SampleScenes/Rendering/Movie Player" section, and has a small private theater that will play the Henry short.  It should look like this:


    Some notes about the demo:
    • It renders differently on GearVR and PC (PC uses Unity's movie textures and GearVR uses some custom stuff).
    • Due to how it runs on GearVR, you need to make sure multi-threaded rendering is disabled, so something to keep in mind with how much you render in your game.
    • The core of the movie play is kept on the MovieSurface object highlighted above.  The script that is attached to it detects PC vs GearVR mode, so no need to tweak that much.