Changeset 183613 in webkit


Ignore:
Timestamp:
Apr 29, 2015 8:40:16 PM (9 years ago)
Author:
eric.carlson@apple.com
Message:

Not all videos should automatically play to playback target
https://bugs.webkit.org/show_bug.cgi?id=144430
<rdar://problem/20718523>

Reviewed by Darin Adler.

  • Modules/mediasession/WebMediaSessionManager.cpp:

(WebCore::WebMediaSessionManager::clientStateDidChange): Consider ExternalDeviceAutoPlayCandidate.
Minor cleanup.

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::mediaState): Set ExternalDeviceAutoPlayCandidate when a <video>
has a file with an audio track that does not loop.

  • page/MediaProducer.h: Add ExternalDeviceAutoPlayCandidate.
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r183612 r183613  
     12015-04-29  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Not all videos should automatically play to playback target
     4        https://bugs.webkit.org/show_bug.cgi?id=144430
     5        <rdar://problem/20718523>
     6
     7        Reviewed by Darin Adler.
     8
     9        * Modules/mediasession/WebMediaSessionManager.cpp:
     10        (WebCore::WebMediaSessionManager::clientStateDidChange): Consider ExternalDeviceAutoPlayCandidate.
     11        Minor cleanup.
     12
     13        * html/HTMLMediaElement.cpp:
     14        (WebCore::HTMLMediaElement::mediaState): Set ExternalDeviceAutoPlayCandidate when a <video>
     15        has a file with an audio track that does not loop.
     16
     17        * page/MediaProducer.h: Add ExternalDeviceAutoPlayCandidate.
     18
    1192015-04-29  Joseph Pecoraro  <pecoraro@apple.com>
    220
  • trunk/Source/WebCore/Modules/mediasession/WebMediaSessionManager.cpp

    r183587 r183613  
    145145        configurePlaybackTargetMonitoring();
    146146
    147     if (!flagsAreSet(newFlags, MediaProducer::IsPlayingVideo))
     147    if (!flagsAreSet(newFlags, MediaProducer::IsPlayingVideo) || !flagsAreSet(newFlags, MediaProducer::ExternalDeviceAutoPlayCandidate))
     148        return;
     149
     150    if (!m_playbackTarget || !m_playbackTarget->hasActiveRoute())
    148151        return;
    149152
     
    157160    }
    158161
    159     if (m_playbackTarget && m_playbackTarget->hasActiveRoute()) {
    160 
    161         for (auto& state : m_clientState) {
    162             if (state->contextId == contextId && state->client == &client)
    163                 continue;
    164             state->client->setShouldPlayToPlaybackTarget(state->contextId, false);
    165         }
    166 
    167         changedClientState->client->setShouldPlayToPlaybackTarget(changedClientState->contextId, true);
    168     }
     162    for (auto& state : m_clientState) {
     163        if (state->contextId == contextId && state->client == &client)
     164            continue;
     165        state->client->setShouldPlayToPlaybackTarget(state->contextId, false);
     166    }
     167
     168    changedClientState->client->setShouldPlayToPlaybackTarget(changedClientState->contextId, true);
    169169
    170170    if (index && m_clientState.size() > 1)
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r183587 r183613  
    61906190
    61916191    bool hasActiveVideo = isVideo() && hasVideo();
     6192    bool hasAudio = this->hasAudio();
    61926193#if ENABLE(WIRELESS_PLAYBACK_TARGET)
    61936194    if (isPlayingToWirelessPlaybackTarget())
     
    61986199            state |= RequiresPlaybackTargetMonitoring;
    61996200    }
     6201
     6202    if (hasActiveVideo && hasAudio && !loop())
     6203        state |= ExternalDeviceAutoPlayCandidate;
     6204
    62006205#endif
    62016206
     
    62036208        return state;
    62046209
    6205     if (hasAudio() && !muted())
     6210    if (hasAudio && !muted())
    62066211        state |= IsPlayingAudio;
    62076212
  • trunk/Source/WebCore/page/MediaProducer.h

    r183096 r183613  
    3737        IsPlayingToExternalDevice = 1 << 2,
    3838        RequiresPlaybackTargetMonitoring = 1 << 3,
     39        ExternalDeviceAutoPlayCandidate = 1 << 4,
    3940    };
    4041    typedef unsigned MediaStateFlags;
Note: See TracChangeset for help on using the changeset viewer.