Title: [179768] trunk/Source/WebCore
Revision
179768
Author
[email protected]
Date
2015-02-06 16:39:59 -0800 (Fri, 06 Feb 2015)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (179767 => 179768)


--- trunk/Source/WebCore/ChangeLog	2015-02-06 23:37:39 UTC (rev 179767)
+++ trunk/Source/WebCore/ChangeLog	2015-02-07 00:39:59 UTC (rev 179768)
@@ -1,3 +1,17 @@
+2015-02-06  Brent Fulgham  <[email protected]>
+
+        [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.
+
 2015-02-06  Bartlomiej Gajda  <[email protected]>
 
         [MSE] Implement Append Error algorithm.

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.h (179767 => 179768)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.h	2015-02-06 23:37:39 UTC (rev 179767)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.h	2015-02-07 00:39:59 UTC (rev 179768)
@@ -83,6 +83,7 @@
     WebVideoFullscreenInterface* m_videoFullscreenInterface;
     FloatRect m_videoFrame;
     Vector<RefPtr<TextTrack>> m_legibleTracksForMenu;
+    Vector<RefPtr<AudioTrack>> m_audioTracksForMenu;
 
     void updateLegibleOptions();
 };

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.mm (179767 => 179768)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.mm	2015-02-06 23:37:39 UTC (rev 179767)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.mm	2015-02-07 00:39:59 UTC (rev 179768)
@@ -302,9 +302,18 @@
     m_videoElement->setVideoFullscreenGravity(videoGravity);
 }
 
-void WebVideoFullscreenModelVideoElement::selectAudioMediaOption(uint64_t)
+void WebVideoFullscreenModelVideoElement::selectAudioMediaOption(uint64_t selectedAudioIndex)
 {
-    // FIXME: 131236 Implement audio track selection.
+    AudioTrack* selectedAudioTrack = nullptr;
+
+    for (size_t index = 0; index < m_audioTracksForMenu.size(); ++index) {
+        auto& audioTrack = m_audioTracksForMenu[index];
+        audioTrack->setEnabled(index == static_cast<size_t>(selectedAudioIndex));
+        if (audioTrack->enabled())
+            selectedAudioTrack = audioTrack.get();
+    }
+
+    m_videoElement->audioTrackEnabledChanged(selectedAudioTrack);
 }
 
 void WebVideoFullscreenModelVideoElement::selectLegibleMediaOption(uint64_t index)
@@ -319,8 +328,10 @@
 
 void WebVideoFullscreenModelVideoElement::updateLegibleOptions()
 {
+    AudioTrackList* audioTrackList = m_videoElement->audioTracks();
     TextTrackList* trackList = m_videoElement->textTracks();
-    if (!trackList || !m_videoElement->document().page() || !m_videoElement->mediaControlsHost())
+
+    if ((!trackList && !audioTrackList) || !m_videoElement->document().page() || !m_videoElement->mediaControlsHost())
         return;
     
     WTF::AtomicString displayMode = m_videoElement->mediaControlsHost()->captionDisplayMode();
@@ -328,6 +339,22 @@
     TextTrack* automaticItem = m_videoElement->mediaControlsHost()->captionMenuAutomaticItem();
     CaptionUserPreferences& captionPreferences = *m_videoElement->document().page()->group().captionPreferences();
     m_legibleTracksForMenu = captionPreferences.sortedTrackListForMenu(trackList);
+
+    m_audioTracksForMenu = captionPreferences.sortedTrackListForMenu(audioTrackList);
+    
+    Vector<String> audioTrackDisplayNames;
+    uint64_t selectedAudioIndex = 0;
+    
+    for (size_t index = 0; index < m_audioTracksForMenu.size(); ++index) {
+        auto& track = m_audioTracksForMenu[index];
+        audioTrackDisplayNames.append(captionPreferences.displayNameForTrack(track.get()));
+        
+        if (track->enabled())
+            selectedAudioIndex = index;
+    }
+    
+    m_videoFullscreenInterface->setAudioMediaSelectionOptions(audioTrackDisplayNames, selectedAudioIndex);
+
     Vector<String> trackDisplayNames;
     uint64_t selectedIndex = 0;
     uint64_t offIndex = 0;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to