From 819dbf9432e1062cc952b4fdfa1518ee16c15f1b Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Mon, 20 Mar 2017 15:28:42 +0100 Subject: winrt: Fix video playback without autoplay enabled We have to ensure that a device handle is present and valid when calling setSource. Otherwise the engine switches into an error state when trying to continue loading. With autoPlay enabled that implicitly happened. Task-number: QTBUG-58152 Change-Id: Id504efd9b1b77b418ae05baed3ac0c52852cf49e Reviewed-by: Oliver Wolff --- src/plugins/winrt/qwinrtmediaplayercontrol.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/winrt/qwinrtmediaplayercontrol.cpp b/src/plugins/winrt/qwinrtmediaplayercontrol.cpp index a4df6306f..9fd48fd76 100644 --- a/src/plugins/winrt/qwinrtmediaplayercontrol.cpp +++ b/src/plugins/winrt/qwinrtmediaplayercontrol.cpp @@ -786,8 +786,12 @@ void QWinRTMediaPlayerControl::setMedia(const QMediaContent &media, QIODevice *s if (d->stream) { hr = d->engine->SetSourceFromByteStream(d->streamProvider.Get(), reinterpret_cast(urlString.data())); - if (FAILED(hr)) + if (FAILED(hr)) { emit error(QMediaPlayer::ResourceError, qt_error_string(hr)); + return; + } + if (d->videoRenderer) + d->videoRenderer->ensureReady(); return; } -- cgit v1.2.3