How to play videos using Unity VideoPlayer and VideoClip API on Android in 5.6.0b1 : <p>Unity introduced new functionality in  5.6.0b1 release  and now it is possilbe to play videos on iPhone and Android. </p>

<p>I managed to make it work on iphone and Windows, but on Android it is stuck on "Preparing" the video.</p>

<p>This is the code I used</p>

<pre><code>public VideoClip videoToPlay;

private VideoPlayer videoPlayer;
private VideoSource videoSource;

//Audio
private AudioSource audioSource;

// Use this for initialization
void Start()
{
    Application.runInBackground = true;
    StartCoroutine(playVideo());
}

IEnumerator playVideo()
{
    //Add VideoPlayer to the GameObject
    videoPlayer = gameObject.AddComponent&lt;VideoPlayer&gt;();

    //Add AudioSource
    audioSource = gameObject.AddComponent&lt;AudioSource&gt;();

    //Disable Play on Awake for both Video and Audio
    videoPlayer.playOnAwake = false;
    audioSource.playOnAwake = false;

    //We want to play from video clip not from url
    videoPlayer.source = VideoSource.VideoClip;

    //Set video To Play then prepare Audio to prevent Buffering
    // videoPlayer.clip = videoToPlay;
    videoPlayer.url = Application.streamingAssetsPath + "/TestVideo.MP4";
    videoPlayer.source = VideoSource.Url;
    VideoClip clip = new VideoClip();

    //Set Audio Output to AudioSource
    videoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource;

    //Assign the Audio from Video to AudioSource to be played
    videoPlayer.EnableAudioTrack(0, true);
    videoPlayer.SetTargetAudioSource(0, audioSource);

    videoPlayer.Prepare();

    //Wait until video is prepared
    while (!videoPlayer.isPrepared)
    {
        Debug.Log("Preparing Video");
        yield return null;
    }

    Debug.Log("Done Preparing Video");

    //Play Video
    videoPlayer.Play();

    //Play Sound
    audioSource.Play();

    Debug.Log("Playing Video");
    while (videoPlayer.isPlaying)
    {
         yield return null;
    }

    Debug.Log("Done Playing Video");
}
</code></pre>

<p>P.S.</p>

<p>In Unity documentation I found that when using android, I need to use WWW class to retrieve the files. The problem is that only MovieTexture is available and no VideoClip from WWW object. Is there a way to convert it?</p>
