안드로이드 10에서 비디오 영상 재생 안되는 경우,
기종: 디클태블릿 현재 유니티 버전 : 2019.4.26
다음과 같이 작성해주면 된다하는데... 제대로 되지않고 있음 ....
public VideoPlayer video;
void Start()
{
video.url=Application.streamingAssetsPath+"/[파일이름].mp4"
}
출처 : https://validming99.tistory.com/94
저는 RawImage에 비디오를 재생시키는 형식으로 사용하고있는데...
url형식으로 바꿨을 경우에 비디오가 끝나는 구간을 찾지못해서 해매고 있음...
다음과 같이 비디오 플레이어를 직접 선언해주면 해결된다는데.....
작성은 해보았으나.. 원하는 구현과 의도가 달라서 사용 못해봄
[SerializeField]
private System.Collections.Generic.List<UnityEngine.Video.VideoClip> videoClips = null;
private UnityEngine.Video.VideoPlayer videoPlayer = null;
private IEnumerator playEnumerator = null;
public void VideoPlay(int num)
{
Application.runInBackground = true;
playEnumerator = VideoPlayCoroutine(num);
StartCoroutine(playEnumerator);
}
public void VideoStop()
{
videoPlayer.Stop();
if (playEnumerator != null)
{
StopCoroutine(playEnumerator);
}
}
private System.Collections.IEnumerator VideoPlayCoroutine(int num)
{
videoPlayer = GetComponent<UnityEngine.Video.VideoPlayer>();
Debug.Assert(videoClips.Count > num);
Debug.Assert(videoClips[num] != null);
videoPlayer.clip = videoClips[num];
videoPlayer.Prepare();
while (!videoPlayer.isPrepared)
{
Debug.Log("Preparing Video");
yield return null;
}
Debug.Log("Done Preparing Video");
videoPlayer.Play();
while (videoPlayer.isPlaying)
{
yield return null;
}
Debug.Log("Played Successfully!!");
}
문제는 해결....
이유가.. 제 영상이 4K였는데 디클에서 4K영상이 호환이 안되는 경우 였음.. ㅜ