Changeset 179768 in webkit


Ignore:
Timestamp:
Feb 6, 2015 4:39:59 PM (9 years ago)
Author:
Brent Fulgham
Message:

[iOS] Implement audio track selection in fullscreen.
https://bugs.webkit.org/show_bug.cgi?id=131236
<rdar://problem/16552632>

Reviewed by Eric Carlson.

  • platform/ios/WebVideoFullscreenModelVideoElement.h:
  • platform/ios/WebVideoFullscreenModelVideoElement.mm:

(WebVideoFullscreenModelVideoElement::selectAudioMediaOption): Provide implementation.
(WebVideoFullscreenModelVideoElement::updateLegibleOptions): Add audio track information
to menu displayed to user.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r179762 r179768  
     12015-02-06  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [iOS] Implement audio track selection in fullscreen.
     4        https://bugs.webkit.org/show_bug.cgi?id=131236
     5        <rdar://problem/16552632>
     6
     7        Reviewed by Eric Carlson.
     8
     9        * platform/ios/WebVideoFullscreenModelVideoElement.h:
     10        * platform/ios/WebVideoFullscreenModelVideoElement.mm:
     11        (WebVideoFullscreenModelVideoElement::selectAudioMediaOption): Provide implementation.
     12        (WebVideoFullscreenModelVideoElement::updateLegibleOptions): Add audio track information
     13        to menu displayed to user.
     14
    1152015-02-06  Bartlomiej Gajda  <b.gajda@samsung.com>
    216
  • trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.h

    r177012 r179768  
    8484    FloatRect m_videoFrame;
    8585    Vector<RefPtr<TextTrack>> m_legibleTracksForMenu;
     86    Vector<RefPtr<AudioTrack>> m_audioTracksForMenu;
    8687
    8788    void updateLegibleOptions();
  • trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.mm

    r179480 r179768  
    303303}
    304304
    305 void WebVideoFullscreenModelVideoElement::selectAudioMediaOption(uint64_t)
    306 {
    307     // FIXME: 131236 Implement audio track selection.
     305void WebVideoFullscreenModelVideoElement::selectAudioMediaOption(uint64_t selectedAudioIndex)
     306{
     307    AudioTrack* selectedAudioTrack = nullptr;
     308
     309    for (size_t index = 0; index < m_audioTracksForMenu.size(); ++index) {
     310        auto& audioTrack = m_audioTracksForMenu[index];
     311        audioTrack->setEnabled(index == static_cast<size_t>(selectedAudioIndex));
     312        if (audioTrack->enabled())
     313            selectedAudioTrack = audioTrack.get();
     314    }
     315
     316    m_videoElement->audioTrackEnabledChanged(selectedAudioTrack);
    308317}
    309318
     
    320329void WebVideoFullscreenModelVideoElement::updateLegibleOptions()
    321330{
     331    AudioTrackList* audioTrackList = m_videoElement->audioTracks();
    322332    TextTrackList* trackList = m_videoElement->textTracks();
    323     if (!trackList || !m_videoElement->document().page() || !m_videoElement->mediaControlsHost())
     333
     334    if ((!trackList && !audioTrackList) || !m_videoElement->document().page() || !m_videoElement->mediaControlsHost())
    324335        return;
    325336   
     
    329340    CaptionUserPreferences& captionPreferences = *m_videoElement->document().page()->group().captionPreferences();
    330341    m_legibleTracksForMenu = captionPreferences.sortedTrackListForMenu(trackList);
     342
     343    m_audioTracksForMenu = captionPreferences.sortedTrackListForMenu(audioTrackList);
     344   
     345    Vector<String> audioTrackDisplayNames;
     346    uint64_t selectedAudioIndex = 0;
     347   
     348    for (size_t index = 0; index < m_audioTracksForMenu.size(); ++index) {
     349        auto& track = m_audioTracksForMenu[index];
     350        audioTrackDisplayNames.append(captionPreferences.displayNameForTrack(track.get()));
     351       
     352        if (track->enabled())
     353            selectedAudioIndex = index;
     354    }
     355   
     356    m_videoFullscreenInterface->setAudioMediaSelectionOptions(audioTrackDisplayNames, selectedAudioIndex);
     357
    331358    Vector<String> trackDisplayNames;
    332359    uint64_t selectedIndex = 0;
Note: See TracChangeset for help on using the changeset viewer.