1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qquickmediaplayer_p.h"
5#include <QtQml/qqmlcontext.h>
6
7QT_BEGIN_NAMESPACE
8
9QQuickMediaPlayer::QQuickMediaPlayer(QObject *parent) : QMediaPlayer(parent) { }
10
11void QQuickMediaPlayer::qmlSetSource(const QUrl &source)
12{
13 if (m_source == source)
14 return;
15 m_source = source;
16 const QQmlContext *context = qmlContext(this);
17 setSource(context ? context->resolvedUrl(source) : source);
18 emit sourceChanged(source);
19}
20
21QUrl QQuickMediaPlayer::qmlSource() const
22{
23 return m_source;
24}
25QT_END_NAMESPACE
26
27#include "moc_qquickmediaplayer_p.cpp"
28

source code of qtmultimedia/src/multimediaquick/qquickmediaplayer.cpp