<?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[Cannot assign to non-existent property &quot;source&quot;]]></title><description><![CDATA[<p dir="auto">This is my code to create a video player but i am met with the error:  Cannot assign to non-existent property "source"</p>
<p dir="auto">import QtQuick 2.15<br />
import QtQuick.Controls 2.15<br />
import QtMultimedia 5.15</p>
<p dir="auto">ApplicationWindow<br />
{<br />
visible: true<br />
width: 800<br />
height: 600<br />
title: "Simple Video Player"</p>
<pre><code>MediaPlayer {
    id: mediaPlayer
}

VideoOutput {
    anchors.fill: parent
    source: mediaPlayer
}

Rectangle {
    anchors.bottom: parent.bottom
    width: parent.width
    height: 50
    color: "black"

    Row {
        anchors.centerIn: parent
        spacing: 10

        Button {
            text: mediaPlayer.playbackState === MediaPlayer.PlayingState ? "Pause" : "Play"
            onClicked: {
                if (mediaPlayer.playbackState === MediaPlayer.PlayingState) {
                    mediaPlayer.pause();
                } else {
                    mediaPlayer.play();
                }
            }
        }

        Slider {
            id: progressSlider
            value: mediaPlayer.position
            maximumValue: mediaPlayer.duration
            onValueChanged: {
                if (progressSlider.pressed) {
                    mediaPlayer.position = progressSlider.value;
                }
            }
        }
    }
}

Component.onCompleted: {
    // Show a File Picker dialog to select the video file
    var fileDialog = Qt.createQmlObject('import QtQuick.Dialogs; FileDialog {}', parent);
    fileDialog.title = "Select a Video File";
    fileDialog.selectExisting = true;
    fileDialog.accepted.connect(function() {
        mediaPlayer.source = fileDialog.fileUrl;
        mediaPlayer.play();
    });
    fileDialog.open();
}}
</code></pre>
]]></description><link>https://forum.qt.io/topic/146963/cannot-assign-to-non-existent-property-source</link><generator>RSS for Node</generator><lastBuildDate>Wed, 14 Oct 2026 22:28:01 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/146963.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 23 Jul 2023 14:14:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Cannot assign to non-existent property &quot;source&quot; on Sun, 23 Jul 2023 16:19:40 GMT]]></title><description><![CDATA[<p dir="auto">Hi @Caroline26. I can make it work using Qt6. Compare your code and make your own conclusions.</p>
<pre><code>import QtQuick
import QtQuick.Window
import QtQuick.Controls
import QtMultimedia

ApplicationWindow {
    id: root
    width: 640
    height: 480
    visible: true
    title: qsTr("Hello World")

    MediaPlayer {
        id: mediaPlayer
        videoOutput: vidOut
    }

    VideoOutput {
        id: vidOut
        anchors.fill: parent
    }

    Rectangle {
        anchors.bottom: parent.bottom
        width: parent.width
        height: 50
        color: "black"

        Row {
            anchors.centerIn: parent
            spacing: 10

            Button{
                text: "Open"
                onClicked: {
                    // Show a File Picker dialog to select the video file
                    var fileDialog = Qt.createQmlObject('import QtQuick.Dialogs; FileDialog {}', root);
                    fileDialog.title = "Select a Video File";
                    //fileDialog.selectExisting = true;
                    fileDialog.accepted.connect(function() {
                        mediaPlayer.source = fileDialog.selectedFile;
                        mediaPlayer.play();
                    });
                    fileDialog.open();


                }
            }

            Button {
                text: mediaPlayer.playbackState === MediaPlayer.PlayingState ? "Pause" : "Play"
                onClicked: {
                    if (mediaPlayer.playbackState === MediaPlayer.PlayingState) {
                        mediaPlayer.pause();
                    } else {
                        mediaPlayer.play();
                    }
                }
            }

            Slider {
                id: progressSlider
                value: mediaPlayer.position
                to: mediaPlayer.duration
                onValueChanged: {
                    if (progressSlider.pressed) {
                        mediaPlayer.position = progressSlider.value;
                    }
                }
            }
        }
    }
}
</code></pre>
]]></description><link>https://forum.qt.io/post/765936</link><guid isPermaLink="true">https://forum.qt.io/post/765936</guid><dc:creator><![CDATA[oria66]]></dc:creator><pubDate>Sun, 23 Jul 2023 16:19:40 GMT</pubDate></item></channel></rss>