Unity + Android SurfaceTexture Update Error
<p>I'm trying to create a Unity-based VR app that uses the Android ExoPlayer for video playback. Unity assets like "EasyMovieTexture" work great for the MediaPlayer, but I need to use the ExoPlayer. I basically have the following:</p>

<p>Java (Android Library):</p>

<pre><code>public void setSurfaceFromTexture(int textureHandle) {
    this.surfaceTexture = new SurfaceTexture(textureHandle);
    this.surface = new Surface(surfaceTexture);
} 
public void updateSurfaceImage() {
    this.surfaceTexture.updateTexImage();
} 
</code></pre>

<p>C# (Unity): </p>

<pre><code>mediaPlayer.Call("setSurfaceFromTexture", texture.GetNativeTexturePtr().ToInt32());
</code></pre>

<p>However, I keep getting the following error when I call <code>updateSurfaceImage</code> each frame:</p>

<blockquote>
  <p>ERROR: java.lang.IllegalStateException: Unable to update texture contents (see logcat for details)</p>
</blockquote>

<p>Any idea what might be going wrong?</p>

<p>Note: I've used the Oculus MoviePlayerSample and got it to work with ExoPlayer. But the Oculus libraries don't work outside the GearVR.</p>