Пытаюсь в Unity3D с помощью компонента VideoPlayer отобразить видео по URL (с IP-камеры). При подключении требуется указать логин и пароль.
public RawImage image;
private VideoPlayer videoPlayer;
private VideoSource videoSource;
private AudioSource audioSource;
private string sourceURL = "http://login:password@192.168.100.108/axis-cgi/mjpg/video.cgi";
void Start () {
Application.runInBackground = true;
StartCoroutine (playVideo ());
}
IEnumerator playVideo () {
videoPlayer = gameObject.AddComponent<VideoPlayer> ();
audioSource = gameObject.AddComponent<AudioSource> ();
videoPlayer.playOnAwake = false;
audioSource.playOnAwake = false;
audioSource.Pause ();
videoPlayer.source = VideoSource.Url;
videoPlayer.url = sourceURL;
videoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource;
videoPlayer.EnableAudioTrack (0, true);
videoPlayer.SetTargetAudioSource (0, audioSource);
videoPlayer.Prepare ();
WaitForSeconds waitTime = new WaitForSeconds (1);
while (!videoPlayer.isPrepared) {
yield return waitTime;
break;
}
image.texture = videoPlayer.texture;
videoPlayer.Play ();
audioSource.Play ();
while (videoPlayer.isPlaying)
yield return null;
}
Выдается ошибка:
WindowsVideoMedia error 0x80070005 while reading http://login:password@192.168.100.108/axis-cgi/mjpg/video.cgi
Через VLC Player к этой же камере таким же URL подключиться удается. Подскажите, пожалуйста, что не так.
Основные этапы разработки сайта для стоматологической клиники
Продвижение своими сайтами как стратегия роста и независимости