Hi!
I’m using VideoPlayer to get a video from a URL, save it to a persistent file path, then play on a plane.
This works great in the Editor (even when I’ve got the platform set to iOS) but when I push it through Xcode, I get a message that reads: “Video unsupported by hardware: may not play smoothly or play at all.”
Some important info:
Unity version: 2019.4.2f1
Video codec: Apple ProRes 444 with alpha
iPad: Air 2
This is the script I’m using:
private void Start()
{
StartCoroutine(this.loadVideoFromThisURL(videoUrl));
}
[SerializeField]
internal UnityEngine.Video.VideoPlayer myVideoPlayer;
string videoUrl ="MY URL HERE";
private IEnumerator loadVideoFromThisURL(string _url)
{
Debug.Log(videoUrl);
progress.SetActive(true);
UnityWebRequest _videoRequest = UnityWebRequest.Get (_url);
yield return _videoRequest.SendWebRequest();
if (_videoRequest.isDone == false || _videoRequest.error != null)
{ Debug.Log ("Request = " + _videoRequest.error );}
Debug.Log ("Video Done - " + _videoRequest.isDone);
byte[] _videoBytes = _videoRequest.downloadHandler.data;
string _pathToFile = Path.Combine (Application.persistentDataPath, "Video.mov");
File.WriteAllBytes (_pathToFile, _videoBytes);
Debug.Log (_pathToFile);
StartCoroutine(this.playThisURLInVideo (_pathToFile));
yield return null;
}
private IEnumerator playThisURLInVideo(string _url)
{
progress.SetActive(false);
myVideoPlayer.source = UnityEngine.Video.VideoSource.Url;
myVideoPlayer.url = _url;
myVideoPlayer.Prepare ();
Debug.Log(_url);
while (myVideoPlayer.isPrepared == false)
{ yield return null;}
Debug.Log ("Video should play");
myVideoPlayer.Play ();
}
}
Has anyone else had this issue or can help me out?
Thanks