Changeset 202100 in webkit
- Timestamp:
- Jun 15, 2016, 12:32:50 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r202097 r202100 1 2016-06-15 Eric Carlson <eric.carlson@apple.com> 2 3 [iOS] Make HTMLMediaElement.muted mutable 4 https://bugs.webkit.org/show_bug.cgi?id=158787 5 <rdar://problem/24452567> 6 7 Reviewed by Dean Jackson. 8 9 * media/audio-playback-restriction-removed-muted-expected.txt: Added. 10 * media/audio-playback-restriction-removed-muted.html: Added. 11 * media/audio-playback-restriction-removed-track-enabled-expected.txt: Added. 12 * media/audio-playback-restriction-removed-track-enabled.html: Added. 13 1 14 2016-06-15 Simon Fraser <simon.fraser@apple.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r202091 r202100 1 2016-06-15 Eric Carlson <eric.carlson@apple.com> 2 3 [iOS] Make HTMLMediaElement.muted mutable 4 https://bugs.webkit.org/show_bug.cgi?id=158787 5 <rdar://problem/24452567> 6 7 Reviewed by Dean Jackson. 8 9 Tests: media/audio-playback-restriction-removed-muted.html 10 media/audio-playback-restriction-removed-track-enabled.html 11 12 * html/HTMLMediaElement.cpp: 13 (WebCore::HTMLMediaElement::audioTrackEnabledChanged): Remove most behavior restrictions if 14 the track state was changed as a result of a user gesture. 15 (WebCore::HTMLMediaElement::setMuted): Ditto. 16 (WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture): Add mask 17 parameter so caller can choose which restrictions are removed. 18 * html/HTMLMediaElement.h: 19 20 * html/MediaElementSession.cpp: 21 (WebCore::restrictionName): Drive-by fix: remove duplicate label. 22 * html/MediaElementSession.h: 23 24 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: 25 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 26 (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): Set muted on AVPlayer if setMuted 27 was called before the player was created. 28 (WebCore::MediaPlayerPrivateAVFoundationObjC::setVolume): Drive-by fix: return early if there 29 is no AVPlayer, not if we won't have metadata yet. 30 (WebCore::MediaPlayerPrivateAVFoundationObjC::setMuted): New. 31 1 32 2016-06-15 Romain Bellessort <romain.bellessort@crf.canon.fr> 2 33 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r202005 r202100 1758 1758 if (m_audioTracks && m_audioTracks->contains(*track)) 1759 1759 m_audioTracks->scheduleChangeEvent(); 1760 if (ScriptController::processingUserGestureForMedia()) 1761 removeBehaviorsRestrictionsAfterFirstUserGesture(MediaElementSession::AllRestrictions & ~MediaElementSession::RequireUserGestureToControlControlsManager); 1760 1762 } 1761 1763 … … 3333 3335 LOG(Media, "HTMLMediaElement::setMuted(%p) - %s", this, boolString(muted)); 3334 3336 3335 #if PLATFORM(IOS)3336 UNUSED_PARAM(muted);3337 #else3338 3337 if (m_muted != muted || !m_explicitlyMuted) { 3339 3338 m_muted = muted; 3340 3339 m_explicitlyMuted = true; 3340 3341 if (ScriptController::processingUserGestureForMedia()) 3342 removeBehaviorsRestrictionsAfterFirstUserGesture(MediaElementSession::AllRestrictions & ~MediaElementSession::RequireUserGestureToControlControlsManager); 3343 3341 3344 // Avoid recursion when the player reports volume changes. 3342 3345 if (!processingMediaPlayerCallback()) { … … 3361 3364 #endif 3362 3365 } 3363 #endif3364 3366 3365 3367 updatePlaybackControlsManager(); … … 6402 6404 #endif 6403 6405 6404 void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture() 6405 { 6406 MediaElementSession::BehaviorRestrictions restrictionsToRemove = MediaElementSession::RequireUserGestureForLoad 6406 void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture(MediaElementSession::BehaviorRestrictions mask) 6407 { 6408 MediaElementSession::BehaviorRestrictions restrictionsToRemove = mask & 6409 (MediaElementSession::RequireUserGestureForLoad 6407 6410 #if ENABLE(WIRELESS_PLAYBACK_TARGET) 6408 6411 | MediaElementSession::RequireUserGestureToShowPlaybackTargetPicker … … 6414 6417 | MediaElementSession::RequireUserGestureForFullscreen 6415 6418 | MediaElementSession::InvisibleAutoplayNotPermitted 6416 | MediaElementSession::RequireUserGestureToControlControlsManager; 6419 | MediaElementSession::RequireUserGestureToControlControlsManager); 6420 6417 6421 m_mediaSession->removeBehaviorRestriction(restrictionsToRemove); 6418 6422 } -
trunk/Source/WebCore/html/HTMLMediaElement.h
r201757 r202100 722 722 void changeNetworkStateFromLoadingToIdle(); 723 723 724 void removeBehaviorsRestrictionsAfterFirstUserGesture( );724 void removeBehaviorsRestrictionsAfterFirstUserGesture(MediaElementSession::BehaviorRestrictions mask = MediaElementSession::AllRestrictions); 725 725 726 726 void updateMediaController(); -
trunk/Source/WebCore/html/MediaElementSession.cpp
r201729 r202100 83 83 CASE(WirelessVideoPlaybackDisabled); 84 84 #endif 85 CASE(RequireUserGestureForAudioRateChange);86 85 CASE(InvisibleAutoplayNotPermitted); 87 86 CASE(OverrideUserGestureRequirementForMainContent); -
trunk/Source/WebCore/html/MediaElementSession.h
r201729 r202100 87 87 RequirePageConsentToResumeMedia = 1 << 4, 88 88 RequireUserGestureForAudioRateChange = 1 << 5, 89 #if ENABLE(WIRELESS_PLAYBACK_TARGET)90 89 RequireUserGestureToShowPlaybackTargetPicker = 1 << 6, 91 90 WirelessVideoPlaybackDisabled = 1 << 7, 92 91 RequireUserGestureToAutoplayToExternalDevice = 1 << 8, 93 #endif94 92 MetadataPreloadingNotPermitted = 1 << 9, 95 93 AutoPreloadingNotPermitted = 1 << 10, … … 97 95 OverrideUserGestureRequirementForMainContent = 1 << 12, 98 96 RequireUserGestureToControlControlsManager = 1 << 13, 97 AllRestrictions = ~NoRestrictions, 99 98 }; 100 99 typedef unsigned BehaviorRestrictions; -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h
r201524 r202100 177 177 MediaTime currentMediaTime() const override; 178 178 void setVolume(float) override; 179 bool supportsMuting() const override { return true; } 180 void setMuted(bool) override; 179 181 void setClosedCaptionsVisible(bool) override; 180 182 void paint(GraphicsContext&, const FloatRect&) override; … … 425 427 bool m_cachedCanPlayFastForward; 426 428 bool m_cachedCanPlayFastReverse; 429 bool m_muted { false }; 427 430 #if ENABLE(WIRELESS_PLAYBACK_TARGET) 428 431 mutable bool m_allowsWirelessVideoPlayback; -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r202013 r202100 1059 1059 #endif 1060 1060 1061 if (m_muted) { 1062 // Clear m_muted so setMuted doesn't return without doing anything. 1063 m_muted = false; 1064 [m_avPlayer.get() setMuted:m_muted]; 1065 } 1066 1061 1067 if (player()->client().mediaPlayerIsVideo()) 1062 1068 createAVPlayerLayer(); … … 1396 1402 return; 1397 1403 #else 1398 if (!m etaDataAvailable())1404 if (!m_avPlayer) 1399 1405 return; 1400 1406 1401 1407 [m_avPlayer.get() setVolume:volume]; 1402 1408 #endif 1409 } 1410 1411 void MediaPlayerPrivateAVFoundationObjC::setMuted(bool muted) 1412 { 1413 if (m_muted == muted) 1414 return; 1415 1416 LOG(Media, "MediaPlayerPrivateAVFoundationObjC::setMuted(%p) - set to %s", this, boolString(muted)); 1417 1418 m_muted = muted; 1419 1420 if (!m_avPlayer) 1421 return; 1422 1423 [m_avPlayer.get() setMuted:m_muted]; 1403 1424 } 1404 1425
Note:
See TracChangeset
for help on using the changeset viewer.