summaryrefslogtreecommitdiffstats
path: root/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@digia.com>2013-08-14 16:42:44 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-27 14:15:54 +0200
commit17a700292ad9289e8de199dc50b3e222ede42e1d (patch)
treeefdd51bbb96f3a71525d2b956b301bbc84f70d36 /src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm
parentd3531cb0cc41a901b11a02d41685532684511bbd (diff)
AVFoundation: Enable use of QMediaPlayer for audio on iOS
This commit disables the video components of the AVFoundation mediaplayer backend when building for iOS and enables the use of QMediaPlayer with audio assets. Change-Id: Iadd6f9c61ed1e656301326e90a22cbca6428b654 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm')
-rw-r--r--src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm b/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm
index 7af6f4394..bb2bc75cb 100644
--- a/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm
+++ b/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm
@@ -240,9 +240,11 @@ static void *AVFMediaPlayerSessionObserverCurrentItemObservationContext = &AVFMe
m_player = [AVPlayer playerWithPlayerItem:m_playerItem];
[m_player retain];
+#if defined(Q_OS_OSX)
//Set the initial volume on new player object
if (self.session)
m_player.volume = m_session->volume() / 100.0f;
+#endif
//Create a new player layer if we don't have one already
if (!m_playerLayer)
@@ -735,10 +737,12 @@ void AVFMediaPlayerSession::setVolume(int volume)
m_volume = volume;
+#if defined(Q_OS_OSX)
AVPlayer *player = [(AVFMediaPlayerSessionObserver*)m_observer player];
if (player) {
[[(AVFMediaPlayerSessionObserver*)m_observer player] setVolume:m_volume / 100.0f];
}
+#endif
Q_EMIT volumeChanged(m_volume);
}
@@ -752,9 +756,9 @@ void AVFMediaPlayerSession::setMuted(bool muted)
return;
m_muted = muted;
-
+#if defined(Q_OS_OSX)
[[(AVFMediaPlayerSessionObserver*)m_observer player] setMuted:m_muted];
-
+#endif
Q_EMIT mutedChanged(muted);
}