Forum Discussion

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

Exoplayer in Unity

We are trying to embed a video using Exoplayer in an Oculus VR app using Unity. I have looked for examples but just can't seem to find any. Any help would really be appreciated.

4 Replies

Replies have been turned off for this discussion
  • Thanks for the answer.
    I used the first link you gave and got it working.

    The second link I had actually seen before. It doesn't seem to explain exactly what to do.
    Just a sort of small overview.

    Is there anywhere where there is a more detailed explanation?
  • Thanks for the help!

    We got it working for a local file.
    Time to work on streaming ......


  • Hi there, we're also looking to use ExoPlayer to play back video in Unity. Can I ask where Oculus have got to on the task to address this functionality on your end? Is this likely to be available for release soon? It could be a big help for us if so.


  • @imperativity

    Hi,

    I recently updated to Unity 2017 and now the following line is failing:

    nativeTexture = Texture2D.CreateExternalTexture(textureWidth, textureHeight,TextureFormat.RGBA32, true, false, IntPtr.Zero);


    The message I get is:  ArgumentException: nativeTex can not be null


    This is my full code:

    OVR_Media_Surface_Init();
    mediaRenderer = GetComponent<Renderer>();
    if (mediaRenderer.material == null || mediaRenderer.material.mainTexture == null)
    {
     Utils.Log("No material for movie surface");
    }
     nativeTexture = Texture2D.CreateExternalTexture(textureWidth, textureHeight,TextureFormat.RGBA32, true, false,IntPtr.Zero);
     IssuePluginEvent(MediaSurfaceEventType.Initialize);
    _androidSurface = OVR_Media_Surface_GetObject();
    _playbackEnvironment.SetSurface(_androidSurface);
    OVR_Media_Surface_SetTextureParms(textureWidth, textureHeight);
    mediaRenderer.material.mainTexture = nativeTexture;