As long as I waited for my DevKit to be delivered, I dreamed of watching some 3D videos with it. So I downloaded all video players I could find made for the Rift and in the end, some were really exciting. But none was really the thing I wanted. Something simple, with an in game menu to select a video and a mechanism to watch a movie while lying down. And because I hacked around with Windows Media Foundation for another project I am working on, I thought that something like this would be the best entry into the world of Rift.
It was not particularly easy to play video in unity. Especially videos in 3D or a variety of formats. I had to write an extension that does the hard work. I know it has been done before, but it was clearly something I wanted to explore. My first version was based on the Media Foundation, but it couldn't handle MKV containers so well. When I recognized that, I decided to support playback via libVLC. I should have done that from the beginning. It is so much easier to do. So now RiftVideoPlayer can play back videos with both engines preferring VLC if it is installed.
- Video card compatible with Direct3D 11
- Oculus Rift
- Windows 7 or later
- optional: VLC 2.x
If you know the navigation of the standard Unity3D Rift demos, than you know the navigation of the "player" already. I also kept the stuff to adjust the vision in. With spacebar you have access to this screen.
RiftVideoPlayer will start with a menu where you can load a movie. Navigate between the menu elements with right/left keys and hit return/A to select an item. You can dismiss the menu by hitting backspace/start.
||Show/hide main menu
||Jump between items
||Used in listbox to select file
||Move screen up relative to current position (rotates around)
||Move screen down relative to current position (rotates around)
|Left Analogue Stick
|Right Analogue Stick
Following command line arguments are supported:
RiftVideoPlayer [movie filename] [-sbs]
Use -sbs for 3D side by side video. All arguments are optional. If you do not provide a movie to play, you can select one from inside the player.
- You have to calibrate the magnetic sensor of the rift by looking into all directions. After that the on screen hint will go away. This prevents drifting of the screen over time.
- Before you select a movie for playback, please select the display mode (2D/3D).
- The player uses VLC if it is installed (HKEY_LOCAL_MACHINE\SOFTWARE\VideoLAN\VLC\InstallDir is set). Otherwise it will use Windows Media foundation, which will result in some files not beeing able to be played.
- In the sources is an Unity3D editor extension included that allows to run the current scene on the rift using my ForceToRift tool. It is triggered by Shift-B or via the menu item Debug/Run on Rift. You can include this in other projects too. Just copy the script RunOnRift.cs and adjust the path to my tool.
If you have any questions (including source code related stuff) or remarks feel free to comment on this post. I have to thank all those, who tried their video player version for the rift. Most of them are really good and were a source of inspiration.