<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QML Video onSourceChanged]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I'm running a Video component as a view's background. I have 4 different video files for 4 different device types/screen aspect ratios. Tablet_Landscape, Tablet_Portrait, Phone_Landscape and Phone_Portrait.</p>
<p dir="auto">I'm creating a binding on the orientation to switch between the Landscape and Portrait videos for the source but I noticed that when changing the orientation the video just disappears. I do get an onSourceChanged event but the new video is not actually loaded. I've looked through the documentation and there's nothing about this. Is there something I should call to load the new source onSourceChanged and start playback or is that simply a limitation of the Video component? There's a workaround with Loaders or possibly Playlists, but I'd rather just use a Source binding as it's just more elegant.</p>
<p dir="auto">My code:</p>
<pre><code>Video {
        id: requirementsScreenId

        anchors.fill: root

        source: {
            if (isPhone())
            {
                if (orientation === "landscape")
                    return "qrc:/Images/Phone_Landscape.mp4"
                else
                    return "qrc:/Images/Phone_Portrait.mp4"
            }
            else
            {
                if (orientation === "landscape")
                    return "qrc:/Images/Tablet_Landscape.mp4"
                else
                    return "qrc:/Images/Tablet_Portrait.mp4"
            }
        }

        autoPlay: true
        loops: MediaPlayer.Infinite
        muted: true
        fillMode: VideoOutput.PreserveAspectCrop
}
</code></pre>
]]></description><link>https://forum.qt.io/topic/146096/qml-video-onsourcechanged</link><generator>RSS for Node</generator><lastBuildDate>Thu, 05 Nov 2026 07:13:09 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/146096.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 29 Jun 2023 14:01:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QML Video onSourceChanged on Thu, 29 Jun 2023 17:42:29 GMT]]></title><description><![CDATA[<p dir="auto">This is on Android by the way, I'll check to see if it happens on iOS too</p>
<p dir="auto">EDIT: Yeah, just on Android. It definitely sounds like an Android bug.</p>
]]></description><link>https://forum.qt.io/post/763075</link><guid isPermaLink="true">https://forum.qt.io/post/763075</guid><dc:creator><![CDATA[Nihilish]]></dc:creator><pubDate>Thu, 29 Jun 2023 17:42:29 GMT</pubDate></item><item><title><![CDATA[Reply to QML Video onSourceChanged on Thu, 29 Jun 2023 16:29:07 GMT]]></title><description><![CDATA[<p dir="auto">When the source changes I'm also getting a I GPUAUX  : [AUX]~GPUAUXContext:71: destory: 0xcf240f68 debug message</p>
]]></description><link>https://forum.qt.io/post/763070</link><guid isPermaLink="true">https://forum.qt.io/post/763070</guid><dc:creator><![CDATA[Nihilish]]></dc:creator><pubDate>Thu, 29 Jun 2023 16:29:07 GMT</pubDate></item><item><title><![CDATA[Reply to QML Video onSourceChanged on Thu, 29 Jun 2023 16:13:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/fcarney">@<bdi>fcarney</bdi></a> I just checked. When the video is working (before the orientation change) the status is "Buffered" and after the orientation change the status seems to be stuck in "Loading"</p>
]]></description><link>https://forum.qt.io/post/763065</link><guid isPermaLink="true">https://forum.qt.io/post/763065</guid><dc:creator><![CDATA[Nihilish]]></dc:creator><pubDate>Thu, 29 Jun 2023 16:13:04 GMT</pubDate></item><item><title><![CDATA[Reply to QML Video onSourceChanged on Thu, 29 Jun 2023 15:56:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/nihilish">@<bdi>Nihilish</bdi></a> check the status of the Video Item:<br />
<a href="https://doc.qt.io/qt-5/qml-qtmultimedia-video.html#status-prop" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qml-qtmultimedia-video.html#status-prop</a></p>
<p dir="auto">I think your paths are wrong.  We only ever quality our paths with qrc in our C++ code.  Not in our qml code.  So you most likely have an error.</p>
<p dir="auto"><strong>Edit:</strong> I did my grep wrong.  We are qualifying some paths in QML with qrc.  Now I am confused why we have a mix.</p>
]]></description><link>https://forum.qt.io/post/763064</link><guid isPermaLink="true">https://forum.qt.io/post/763064</guid><dc:creator><![CDATA[fcarney]]></dc:creator><pubDate>Thu, 29 Jun 2023 15:56:45 GMT</pubDate></item></channel></rss>