Commit 134ccfc9 authored by eric.carlson@apple.com's avatar eric.carlson@apple.com
Browse files

Add support for in-band text tracks to Mac port

https://bugs.webkit.org/show_bug.cgi?id=103663

Reviewed by Sam Weinig.

Source/WebCore: 

Test: media/track/track-in-band.html

* GNUmakefile.list.am: Move InbandTextTrackPrivate.h to platform/graphics. Add InbandTextTrackPrivateClient.h.
* Target.pri: Ditto.
* WebCore.gypi: Ditto.

* WebCore.xcodeproj/project.pbxproj: Add new files.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setReadyState): No need to call processInbandTextTracks, in-band tracks
    are now registered by the media engine as they are discovered.
(WebCore::HTMLMediaElement::mediaPlayerDidAddTrack): New, called by the media player when a new
    in-band track is found.
(WebCore::HTMLMediaElement::mediaPlayerDidRemoveTrack): New, called by the media player when an
    in-band track goes away.
* html/HTMLMediaElement.h:

* html/track/InbandTextTrack.cpp:
(WebCore::InbandTextTrack::InbandTextTrack): Use m_private instead of tracksPrivate because
    it is zeroed during assignment.

* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::addTextTrack): New MediaPlayerClient method to allow MediaPlayerPrivate subclasses
    to add a new in-band track.
(WebCore::MediaPlayer::removeTextTrack): New MediaPlayerClient method to allow MediaPlayerPrivate subclasses
    to remove a new in-band track.
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:

* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: Added.
(WebCore::InbandTextTrackPrivateAVF::InbandTextTrackPrivateAVF):
(WebCore::InbandTextTrackPrivateAVF::~InbandTextTrackPrivateAVF):
(WebCore::InbandTextTrackPrivateAVF::processCueAttributes): Convert an attribute string into WebVTT 
    cue setting and content strings.
(WebCore::InbandTextTrackPrivateAVF::processCue): Process a new cue.
(WebCore::InbandTextTrackPrivateAVF::disconnect): Clear member variables.
(WebCore::InbandTextTrackPrivateAVF::resetCueValues): Reset cue values to defaults.
(WebCore::InbandTextTrackPrivateAVF::setMode): Set track mode and call player's trackModeChanged.
* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h: Added.

* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: Initialize 
    m_inbandTrackConfigurationPending.
(WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation):
(WebCore::MediaPlayerPrivateAVFoundation::seekCompleted): Flush the currently accumulating
    cue so it doesn't get the wrong duration.
(WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification): Handle InbandTracksNeedConfiguration.
(WebCore::MediaPlayerPrivateAVFoundation::flushCurrentCue): New, pass the current cue up to the client.
(WebCore::MediaPlayerPrivateAVFoundation::configureInbandTracks): Configure in-band tracks.
(WebCore::MediaPlayerPrivateAVFoundation::trackModeChanged): Schedule a call to configureInbandTracks.
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:

* platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.h: Added.
* platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm: Added.
(WebCore::InbandTextTrackPrivateAVFObjC::InbandTextTrackPrivateAVFObjC):
(WebCore::InbandTextTrackPrivateAVFObjC::disconnect):
(WebCore::InbandTextTrackPrivateAVFObjC::kind): Return track kind.
(WebCore::InbandTextTrackPrivateAVFObjC::label): Return track label.
(WebCore::InbandTextTrackPrivateAVFObjC::language): Return track language.
(WebCore::InbandTextTrackPrivateAVFObjC::isDefault): 
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
(MediaPlayerPrivateAVFoundationObjC):
(WebCore::MediaPlayerPrivateAVFoundationObjC::playerItem):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC): Initialize m_currentTrack.
(WebCore::MediaPlayerPrivateAVFoundationObjC::cancelLoad): Clear m_legibleOutput.
(WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged): Create and initialize m_legibleOutput.
(WebCore::MediaPlayerPrivateAVFoundationObjC::processTextTracks): Called when the player item's
    "tracks" changes, add and remove in-band text tracks as necessary.
(WebCore::MediaPlayerPrivateAVFoundationObjC::processCue): Pass an attributed string to the current 
    track to be processed.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setCurrentTrack): Tell AVFoundation to select an in-band track.
(WebCore::MediaPlayerPrivateAVFoundationObjC::currentTrack): Return the current track.
(-[WebCoreAVFMovieObserver legibleOutput:didOutputAttributedStrings:nativeSampleBuffers:forItemTime:]): Legible
    output delegate.

Source/WTF: 

* wtf/Platform.h: Define HAVE_AVFOUNDATION_TEXT_TRACK_SUPPORT.

LayoutTests: 

Test for initial support for in-band text tracks. New test skipped on all ports that don't 
have support in the media engine.

* media/content/counting-subtitled.m4v: Added.
* media/track/track-in-band-expected.txt: Added.
* media/track/track-in-band.html: Added.
* platform/chromium/TestExpectations:
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/mac/TestExpectations:
* platform/qt/TestExpectations:
* platform/win/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@137161 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 407048b1
2012-12-10 Eric Carlson <eric.carlson@apple.com>
Add support for in-band text tracks to Mac port
https://bugs.webkit.org/show_bug.cgi?id=103663
Reviewed by Sam Weinig.
Test for initial support for in-band text tracks. New test skipped on all ports that don't
have support in the media engine.
* media/content/counting-subtitled.m4v: Added.
* media/track/track-in-band-expected.txt: Added.
* media/track/track-in-band.html: Added.
* platform/chromium/TestExpectations:
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/mac/TestExpectations:
* platform/qt/TestExpectations:
* platform/win/TestExpectations:
2012-12-10 Ilya Tikhonovsky <loislo@chromium.org>
 
Unreviewed: Web Inspector: update test expectation for inspector/styles/styles-computed-trace.html.
......@@ -7966,12 +7986,12 @@
* platform/chromium-mac-snowleopard/fast/forms/date/date-appearance-pseudo-classes-expected.png: Removed.
* platform/chromium-mac/fast/forms/date/date-appearance-pseudo-classes-expected.png: Removed.
* platform/chromium-win/fast/forms/date/date-appearance-pseudo-classes-expected.png: Removed.
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/mac/TestExpectations:
* platform/qt/TestExpectations:
* platform/win/TestExpectations:
2012-11-28 Tommy Widenflycht <tommyw@google.com>
 
Add basic implementation for MediaStreamAudioDestinationNode
In-band text tracks.
EVENT(canplaythrough)
** Check initial in-band track states
EXPECTED (video.textTracks.length == '2') OK
EXPECTED (addtrackEventCount == '2') OK
RUN(inbandTrack1 = video.textTracks[0])
RUN(inbandTrack2 = video.textTracks[1])
EXPECTED (inbandTrack1.mode == 'disabled') OK
EXPECTED (inbandTrack1.cues == 'null') OK
EXPECTED (inbandTrack1.language == 'en') OK
EXPECTED (inbandTrack1.kind == 'subtitles') OK
EXPECTED (inbandTrack2.mode == 'disabled') OK
EXPECTED (inbandTrack2.cues == 'null') OK
EXPECTED (inbandTrack2.language == 'fr') OK
EXPECTED (inbandTrack2.kind == 'subtitles') OK
** Add tracks, check sort order
RUN(addTrack = video.addTextTrack('captions', 'Caption Track', 'en'))
RUN(trackElement = document.createElement('track'))
RUN(video.appendChild(trackElement))
EXPECTED (video.textTracks.length == '4') OK
EXPECTED (video.textTracks[0] == 'trackElement.track') OK
EXPECTED (video.textTracks[1] == 'addTrack') OK
EXPECTED (video.textTracks[2] == 'inbandTrack1') OK
EXPECTED (video.textTracks[3] == 'inbandTrack2') OK
END OF TEST
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src=../media-file.js></script>
<script src=../video-test.js></script>
<script>
var addtrackEventCount = 0;
function compareTracks(track1, track2)
{
var equal = (eval(track1) == eval(track2));
reportExpected(equal, track1, "==", track2, track1);
}
function canplaythrough()
{
consoleWrite("<br><i>** Check initial in-band track states<" + "/i>");
testExpected("video.textTracks.length", 2);
testExpected("addtrackEventCount", 2);
consoleWrite("<br>");
run("inbandTrack1 = video.textTracks[0]");
run("inbandTrack2 = video.textTracks[1]");
testExpected("inbandTrack1.mode", "disabled");
testExpected("inbandTrack1.cues", null);
testExpected("inbandTrack1.language", "en");
testExpected("inbandTrack1.kind", "subtitles");
testExpected("inbandTrack2.mode", "disabled");
testExpected("inbandTrack2.cues", null);
testExpected("inbandTrack2.language", "fr");
testExpected("inbandTrack2.kind", "subtitles");
consoleWrite("<br><i>** Add tracks, check sort order<" + "/i>");
run("addTrack = video.addTextTrack('captions', 'Caption Track', 'en')");
run("trackElement = document.createElement('track')");
trackElement.label = '<track>';
run("video.appendChild(trackElement)");
testExpected("video.textTracks.length", 4);
compareTracks("video.textTracks[0]", "trackElement.track");
compareTracks("video.textTracks[1]", "addTrack");
compareTracks("video.textTracks[2]", "inbandTrack1");
compareTracks("video.textTracks[3]", "inbandTrack2");
endTest();
}
function setup()
{
findMediaElement();
video.textTracks.addEventListener("addtrack", function() { ++addtrackEventCount; });
video.src = '../content/counting-subtitled.m4v';
waitForEvent('canplaythrough', canplaythrough);
}
</script>
</head>
<body onload="setup()">
<video controls></video>
<p>In-band text tracks.</p>
</body>
</html>
......@@ -4221,5 +4221,8 @@ webkit.org/b/94002 [ Mac Debug ] inspector/debugger/live-edit.html [ Crash Pass
# Asserting since r136948.
webkit.org/b/104473 [ Debug ] inspector/styles/import-pseudoclass-crash.html [ Crash ]
# No support for exposing in-band text tracks
webkit.org/b/103767 [ Win Mac Linux ] media/track/track-in-band.html [ Skip ]
# Flaky on Win (perhaps due to lighttpd?)
webkit.org/b/104489 [ Win ] http/tests/w3c/webperf/submission/resource-timing/html/test_resource_attribute_order.html [ Failure Pass ]
......@@ -1660,6 +1660,9 @@ webkit.org/b/103109 fast/dom/shadow/host-wrapper-reclaimed.html [ Failure ]
# No spellcheck suggestions in context menu
Bug(EFL) editing/spelling/context-menu-suggestions.html [ Failure ]
# No support for exposing in-band text tracks
Bug(EFL) media/track/track-in-band.html [ Skip ]
# Newly added test in r136225 fails on GTK bot too.
webkit.org/b/103740 editing/selection/caret-alignment-for-vertical-text.html [ Failure ]
......
......@@ -1422,6 +1422,9 @@ webkit.org/b/104493 svg/custom/js-update-transform-addition.svg [ Failure ]
webkit.org/b/104493 svg/custom/js-update-transform-changes.svg [ Failure ]
webkit.org/b/104493 svg/custom/text-xy-updates-SVGList.xhtml [ Failure ]
# No support for exposing in-band text tracks
webkit.org/b/103771 media/track/track-in-band.html [ Skip ]
#////////////////////////////////////////////////////////////////////////////////////////
# End of Tests failing
#////////////////////////////////////////////////////////////////////////////////////////
......@@ -1240,4 +1240,7 @@ Bug(jernoble) [ MountainLion Lion SnowLeopard ] media/video-src-blob.html
webkit.org/b/102579 fast/css/cursor-parsing-image-set.html [ Fail ]
webkit.org/b/102579 fast/events/mouse-cursor-image-set.html [ Fail ]
# Mountain Lion and prior do not allow access to in-band text tracks
webkit.org/b/103663 [ MountainLion Lion SnowLeopard ] media/track/track-in-band.html
webkit.org/b/104104 fast/overflow/scrollbar-click-retains-focus.html [ Failure ]
......@@ -2437,6 +2437,9 @@ webkit.org/b/61138 http/tests/w3c/webperf/submission/resource-timing [ Skip ]
# [Qt] A new compositing bug uncovered by r135859
webkit.org/b/103424 fast/backgrounds/background-opaque-images-over-color.html
# No support for exposing in-band text tracks
webkit.org/b/103769 media/track/track-in-band.html [ Skip ]
webkit.org/b/104150 fast/media/implicit-media-all.html [ ImageOnlyFailure ]
# [Qt] new fast/exclusions/shape-inside/shape-inside-rounded-rectangle-fit-002.html fails since introduced in r136857
......
......@@ -2487,6 +2487,9 @@ editing/execCommand/switch-list-type-with-orphaned-li.html
# https://bugs.webkit.org/show_bug.cgi?id=103962
fast/js/kde/Array.html
# No support for exposing in-band text tracks
webkit.org/b/103770 media/track/track-in-band.html [ Skip ]
# https://bugs.webkit.org/show_bug.cgi?id=97026
fast/events/keydown-leftright-keys.html
fast/loader/javascript-url-in-embed.html
......
2012-12-10 Eric Carlson <eric.carlson@apple.com>
Add support for in-band text tracks to Mac port
https://bugs.webkit.org/show_bug.cgi?id=103663
Reviewed by Sam Weinig.
* wtf/Platform.h: Define HAVE_AVFOUNDATION_TEXT_TRACK_SUPPORT.
2012-12-08 Patrick Gansterer <paroga@webkit.org>
Compiling WTF outside of WebKit failed on Windows
......
......@@ -1165,6 +1165,10 @@
#define WTF_USE_COREMEDIA 1
#endif
#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
#define HAVE_AVFOUNDATION_TEXT_TRACK_SUPPORT 1
#endif
#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(EFL) || (PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(WIN_CAIRO)) || PLATFORM(BLACKBERRY)
#define WTF_USE_REQUEST_ANIMATION_FRAME_TIMER 1
#endif
......
2012-12-10 Eric Carlson <eric.carlson@apple.com>
Add support for in-band text tracks to Mac port
https://bugs.webkit.org/show_bug.cgi?id=103663
Reviewed by Sam Weinig.
Test: media/track/track-in-band.html
* GNUmakefile.list.am: Move InbandTextTrackPrivate.h to platform/graphics. Add InbandTextTrackPrivateClient.h.
* Target.pri: Ditto.
* WebCore.gypi: Ditto.
* WebCore.xcodeproj/project.pbxproj: Add new files.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setReadyState): No need to call processInbandTextTracks, in-band tracks
are now registered by the media engine as they are discovered.
(WebCore::HTMLMediaElement::mediaPlayerDidAddTrack): New, called by the media player when a new
in-band track is found.
(WebCore::HTMLMediaElement::mediaPlayerDidRemoveTrack): New, called by the media player when an
in-band track goes away.
* html/HTMLMediaElement.h:
* html/track/InbandTextTrack.cpp:
(WebCore::InbandTextTrack::InbandTextTrack): Use m_private instead of tracksPrivate because
it is zeroed during assignment.
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::addTextTrack): New MediaPlayerClient method to allow MediaPlayerPrivate subclasses
to add a new in-band track.
(WebCore::MediaPlayer::removeTextTrack): New MediaPlayerClient method to allow MediaPlayerPrivate subclasses
to remove a new in-band track.
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:
* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: Added.
(WebCore::InbandTextTrackPrivateAVF::InbandTextTrackPrivateAVF):
(WebCore::InbandTextTrackPrivateAVF::~InbandTextTrackPrivateAVF):
(WebCore::InbandTextTrackPrivateAVF::processCueAttributes): Convert an attribute string into WebVTT
cue setting and content strings.
(WebCore::InbandTextTrackPrivateAVF::processCue): Process a new cue.
(WebCore::InbandTextTrackPrivateAVF::disconnect): Clear member variables.
(WebCore::InbandTextTrackPrivateAVF::resetCueValues): Reset cue values to defaults.
(WebCore::InbandTextTrackPrivateAVF::setMode): Set track mode and call player's trackModeChanged.
* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h: Added.
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: Initialize
m_inbandTrackConfigurationPending.
(WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation):
(WebCore::MediaPlayerPrivateAVFoundation::seekCompleted): Flush the currently accumulating
cue so it doesn't get the wrong duration.
(WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification): Handle InbandTracksNeedConfiguration.
(WebCore::MediaPlayerPrivateAVFoundation::flushCurrentCue): New, pass the current cue up to the client.
(WebCore::MediaPlayerPrivateAVFoundation::configureInbandTracks): Configure in-band tracks.
(WebCore::MediaPlayerPrivateAVFoundation::trackModeChanged): Schedule a call to configureInbandTracks.
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
* platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.h: Added.
* platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm: Added.
(WebCore::InbandTextTrackPrivateAVFObjC::InbandTextTrackPrivateAVFObjC):
(WebCore::InbandTextTrackPrivateAVFObjC::disconnect):
(WebCore::InbandTextTrackPrivateAVFObjC::kind): Return track kind.
(WebCore::InbandTextTrackPrivateAVFObjC::label): Return track label.
(WebCore::InbandTextTrackPrivateAVFObjC::language): Return track language.
(WebCore::InbandTextTrackPrivateAVFObjC::isDefault):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
(MediaPlayerPrivateAVFoundationObjC):
(WebCore::MediaPlayerPrivateAVFoundationObjC::playerItem):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC): Initialize m_currentTrack.
(WebCore::MediaPlayerPrivateAVFoundationObjC::cancelLoad): Clear m_legibleOutput.
(WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged): Create and initialize m_legibleOutput.
(WebCore::MediaPlayerPrivateAVFoundationObjC::processTextTracks): Called when the player item's
"tracks" changes, add and remove in-band text tracks as necessary.
(WebCore::MediaPlayerPrivateAVFoundationObjC::processCue): Pass an attributed string to the current
track to be processed.
(WebCore::MediaPlayerPrivateAVFoundationObjC::setCurrentTrack): Tell AVFoundation to select an in-band track.
(WebCore::MediaPlayerPrivateAVFoundationObjC::currentTrack): Return the current track.
(-[WebCoreAVFMovieObserver legibleOutput:didOutputAttributedStrings:nativeSampleBuffers:forItemTime:]): Legible
output delegate.
2012-12-10 Pavel Feldman <pfeldman@chromium.org>
 
Web Inspector: fix front-end compilation warnings
......@@ -3617,7 +3617,6 @@ webcore_sources += \
Source/WebCore/html/TimeRanges.h \
Source/WebCore/html/track/InbandTextTrack.cpp \
Source/WebCore/html/track/InbandTextTrack.h \
Source/WebCore/html/track/InbandTextTrackPrivate.h \
Source/WebCore/html/track/LoadableTextTrack.cpp \
Source/WebCore/html/track/LoadableTextTrack.h \
Source/WebCore/html/track/TextTrack.cpp \
......@@ -5519,6 +5518,8 @@ webcore_platform_sources += \
Source/WebCore/platform/graphics/ImageOrientation.h \
Source/WebCore/platform/graphics/ImageSource.cpp \
Source/WebCore/platform/graphics/ImageSource.h \
Source/WebCore/platform/graphics/InbandTextTrackPrivate.h \
Source/WebCore/platform/graphics/InbandTextTrackPrivateClient.h \
Source/WebCore/platform/graphics/IntPoint.h \
Source/WebCore/platform/graphics/IntPointHash.h \
Source/WebCore/platform/graphics/IntRect.cpp \
......
......@@ -1884,7 +1884,6 @@ HEADERS += \
html/shadow/MediaControlsApple.h \
html/shadow/DetailsMarkerControl.h \
html/track/InbandTextTrack.h \
html/track/InbandTextTrackPrivate.h \
html/track/LoadableTextTrack.h \
html/track/TextTrack.h \
html/track/TextTrackCue.h \
......@@ -2174,6 +2173,8 @@ HEADERS += \
platform/graphics/Image.h \
platform/graphics/ImageOrientation.h \
platform/graphics/ImageSource.h \
platform/graphics/InbandTextTrackPrivate.h \
platform/graphics/InbandTextTrackPrivateClient.h \
platform/graphics/IntPoint.h \
platform/graphics/IntPointHash.h \
platform/graphics/IntRect.h \
......
......@@ -3396,7 +3396,6 @@
'html/shadow/TextFieldDecorationElement.h',
'html/track/InbandTextTrack.cpp',
'html/track/InbandTextTrack.h',
'html/track/InbandTextTrackPrivate.h',
'html/track/LoadableTextTrack.cpp',
'html/track/LoadableTextTrack.h',
'html/track/TextTrack.cpp',
......@@ -3714,6 +3713,8 @@
'platform/graphics/ImageBuffer.cpp',
'platform/graphics/ImageOrientation.cpp',
'platform/graphics/ImageSource.cpp',
'platform/graphics/InbandTextTrackPrivate.h',
'platform/graphics/InbandTextTrackPrivateClient.h',
'platform/graphics/Latin1TextIterator.h',
'platform/graphics/MediaPlayer.cpp',
'platform/graphics/MediaPlayerPrivate.h',
......
......@@ -108,9 +108,6 @@
070756DF14239B4E00414161 /* JSTextTrackCueList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 070756D914239B4C00414161 /* JSTextTrackCueList.cpp */; };
070756E014239B4E00414161 /* JSTextTrackCueList.h in Headers */ = {isa = PBXBuildFile; fileRef = 070756DA14239B4E00414161 /* JSTextTrackCueList.h */; };
0709FC4E1025DEE30059CDBA /* AccessibilitySlider.h in Headers */ = {isa = PBXBuildFile; fileRef = 0709FC4D1025DEE30059CDBA /* AccessibilitySlider.h */; };
0711BF8E1642D9D100419E36 /* InbandTextTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0711BF8D1642D9D100419E36 /* InbandTextTrack.cpp */; };
0711BF8F1642D9F400419E36 /* InbandTextTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 0711BF8C1642D81100419E36 /* InbandTextTrack.h */; };
0711BF9116430C9100419E36 /* InbandTextTrackPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 0711BF9016430C9000419E36 /* InbandTextTrackPrivate.h */; };
0720B0A014D3323500642955 /* GenericEventQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0720B09E14D3323500642955 /* GenericEventQueue.cpp */; };
0720B0A014D3323500642956 /* GestureEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0720B09F14D3323500642956 /* GestureEvent.cpp */; };
0720B0A114D3323500642955 /* GenericEventQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 0720B09F14D3323500642955 /* GenericEventQueue.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -125,16 +122,24 @@
07846342145B151A00A58DF1 /* JSTrackEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07846340145B151A00A58DF1 /* JSTrackEvent.cpp */; };
07846343145B151A00A58DF1 /* JSTrackEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 07846341145B151A00A58DF1 /* JSTrackEvent.h */; };
07846385145B1B8E00A58DF1 /* JSTrackCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 07846384145B1B8E00A58DF1 /* JSTrackCustom.h */; };
07941791166E855F009416C2 /* InbandTextTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0794178F166E855F009416C2 /* InbandTextTrack.cpp */; };
07941792166E855F009416C2 /* InbandTextTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 07941790166E855F009416C2 /* InbandTextTrack.h */; };
07941794166EA04E009416C2 /* InbandTextTrackPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 07941793166EA04E009416C2 /* InbandTextTrackPrivate.h */; };
079D0868162F20E800DB8658 /* CaptionUserPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 079D0867162F20E800DB8658 /* CaptionUserPreferences.h */; settings = {ATTRIBUTES = (Private, ); }; };
079D086B162F21F900DB8658 /* CaptionUserPreferencesMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 079D0869162F21F900DB8658 /* CaptionUserPreferencesMac.h */; };
079D086C162F21F900DB8658 /* CaptionUserPreferencesMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 079D086A162F21F900DB8658 /* CaptionUserPreferencesMac.mm */; };
07A6D1EB1491137700051D0C /* MediaFragmentURIParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07A6D1E91491137700051D0C /* MediaFragmentURIParser.cpp */; };
07A6D1EC1491137700051D0C /* MediaFragmentURIParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 07A6D1EA1491137700051D0C /* MediaFragmentURIParser.h */; };
07AA6B6B166D2C0700D45671 /* InbandTextTrackPrivateAVFObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07AA6B6A166D019500D45671 /* InbandTextTrackPrivateAVFObjC.mm */; };
07AA6B6C166D2C1300D45671 /* InbandTextTrackPrivateAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = 07AA6B69166D019500D45671 /* InbandTextTrackPrivateAVFObjC.h */; settings = {ATTRIBUTES = (Private, ); }; };
07B0113F1032242200FBDC33 /* AccessibilityMediaControls.h in Headers */ = {isa = PBXBuildFile; fileRef = 07B0113E1032242200FBDC33 /* AccessibilityMediaControls.h */; };
07B442D6166C70B000556CAD /* InbandTextTrackPrivateAVF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07B442D4166C70B000556CAD /* InbandTextTrackPrivateAVF.cpp */; };
07B442D7166C70B000556CAD /* InbandTextTrackPrivateAVF.h in Headers */ = {isa = PBXBuildFile; fileRef = 07B442D5166C70B000556CAD /* InbandTextTrackPrivateAVF.h */; settings = {ATTRIBUTES = (Private, ); }; };
07B5A2DB1464320A00A81ECE /* JSTextTrackList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07B5A2D91464320A00A81ECE /* JSTextTrackList.cpp */; };
07B5A2DC1464320A00A81ECE /* JSTextTrackList.h in Headers */ = {isa = PBXBuildFile; fileRef = 07B5A2DA1464320A00A81ECE /* JSTextTrackList.h */; };
07B5A30D14687D7100A81ECE /* JSTextTrackListCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07B5A30C14687D7100A81ECE /* JSTextTrackListCustom.cpp */; };
07BDD6EC1469B4C2009C9F85 /* JSTrackEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07B5A30A14687B8400A81ECE /* JSTrackEventCustom.cpp */; };
07CE77D516712A6A00C55A47 /* InbandTextTrackPrivateClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 07CE77D416712A6A00C55A47 /* InbandTextTrackPrivateClient.h */; };
07E116B11489C9A100EC5ACE /* JSTextTrackCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07E116B01489C9A100EC5ACE /* JSTextTrackCustom.cpp */; };
07E117071489EBEB00EC5ACE /* JSTextTrackCueCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07E117061489EBEB00EC5ACE /* JSTextTrackCueCustom.cpp */; };
0806E57A12893045007CED32 /* SVGMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = 0806E57912893045007CED32 /* SVGMatrix.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -7213,9 +7218,6 @@
070756DA14239B4E00414161 /* JSTextTrackCueList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTextTrackCueList.h; sourceTree = "<group>"; };
0709FC4D1025DEE30059CDBA /* AccessibilitySlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilitySlider.h; sourceTree = "<group>"; };
070DD8F50F01868000727DEB /* mediaControls.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mediaControls.css; sourceTree = "<group>"; };
0711BF8C1642D81100419E36 /* InbandTextTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InbandTextTrack.h; sourceTree = "<group>"; };
0711BF8D1642D9D100419E36 /* InbandTextTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InbandTextTrack.cpp; sourceTree = "<group>"; };
0711BF9016430C9000419E36 /* InbandTextTrackPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InbandTextTrackPrivate.h; sourceTree = "<group>"; };
0720B09E14D3323500642955 /* GenericEventQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GenericEventQueue.cpp; sourceTree = "<group>"; };
0720B09F14D3323500642955 /* GenericEventQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericEventQueue.h; sourceTree = "<group>"; };
0720B09F14D3323500642956 /* GestureEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GestureEvent.cpp; sourceTree = "<group>"; };
......@@ -7230,19 +7232,27 @@
07846340145B151A00A58DF1 /* JSTrackEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTrackEvent.cpp; sourceTree = "<group>"; };
07846341145B151A00A58DF1 /* JSTrackEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTrackEvent.h; sourceTree = "<group>"; };
07846384145B1B8E00A58DF1 /* JSTrackCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTrackCustom.h; sourceTree = "<group>"; };
0794178F166E855F009416C2 /* InbandTextTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InbandTextTrack.cpp; sourceTree = "<group>"; };
07941790166E855F009416C2 /* InbandTextTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InbandTextTrack.h; sourceTree = "<group>"; };
07941793166EA04E009416C2 /* InbandTextTrackPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InbandTextTrackPrivate.h; sourceTree = "<group>"; };
079D0867162F20E800DB8658 /* CaptionUserPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CaptionUserPreferences.h; sourceTree = "<group>"; };
079D0869162F21F900DB8658 /* CaptionUserPreferencesMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CaptionUserPreferencesMac.h; sourceTree = "<group>"; };
079D086A162F21F900DB8658 /* CaptionUserPreferencesMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CaptionUserPreferencesMac.mm; sourceTree = "<group>"; };
079F5E4B0F3BEBEA005E0782 /* MediaPlayerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaPlayerPrivate.h; sourceTree = "<group>"; };
07A6D1E91491137700051D0C /* MediaFragmentURIParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaFragmentURIParser.cpp; sourceTree = "<group>"; };
07A6D1EA1491137700051D0C /* MediaFragmentURIParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaFragmentURIParser.h; sourceTree = "<group>"; };
07AA6B69166D019500D45671 /* InbandTextTrackPrivateAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InbandTextTrackPrivateAVFObjC.h; path = objc/InbandTextTrackPrivateAVFObjC.h; sourceTree = "<group>"; };
07AA6B6A166D019500D45671 /* InbandTextTrackPrivateAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = InbandTextTrackPrivateAVFObjC.mm; path = objc/InbandTextTrackPrivateAVFObjC.mm; sourceTree = "<group>"; };
07AFE5900F1446BD00841617 /* mediaControlsQuickTime.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = mediaControlsQuickTime.css; sourceTree = "<group>"; };
07B0113E1032242200FBDC33 /* AccessibilityMediaControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityMediaControls.h; sourceTree = "<group>"; };
07B442D4166C70B000556CAD /* InbandTextTrackPrivateAVF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InbandTextTrackPrivateAVF.cpp; sourceTree = "<group>"; };
07B442D5166C70B000556CAD /* InbandTextTrackPrivateAVF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InbandTextTrackPrivateAVF.h; sourceTree = "<group>"; };
07B5A2D91464320A00A81ECE /* JSTextTrackList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTextTrackList.cpp; sourceTree = "<group>"; };
07B5A2DA1464320A00A81ECE /* JSTextTrackList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTextTrackList.h; sourceTree = "<group>"; };
07B5A3061468537100A81ECE /* TextTrackList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TextTrackList.idl; sourceTree = "<group>"; };
07B5A30A14687B8400A81ECE /* JSTrackEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTrackEventCustom.cpp; sourceTree = "<group>"; };
07B5A30C14687D7100A81ECE /* JSTextTrackListCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTextTrackListCustom.cpp; sourceTree = "<group>"; };
07CE77D416712A6A00C55A47 /* InbandTextTrackPrivateClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InbandTextTrackPrivateClient.h; sourceTree = "<group>"; };
07E116B01489C9A100EC5ACE /* JSTextTrackCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTextTrackCustom.cpp; sourceTree = "<group>"; };
07E117061489EBEB00EC5ACE /* JSTextTrackCueCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTextTrackCueCustom.cpp; sourceTree = "<group>"; };
07E38A0B148FCF0C006E1ECC /* JSTextTrackCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTextTrackCustom.h; sourceTree = "<group>"; };
......@@ -14284,6 +14294,8 @@
076F0D0812B8192700C26AA4 /* avfoundation */ = {
isa = PBXGroup;
children = (
07B442D4166C70B000556CAD /* InbandTextTrackPrivateAVF.cpp */,
07B442D5166C70B000556CAD /* InbandTextTrackPrivateAVF.h */,
DF9AFD6F13FC31B00015FEB7 /* objc */,
076F0D0912B8192700C26AA4 /* MediaPlayerPrivateAVFoundation.cpp */,
076F0D0A12B8192700C26AA4 /* MediaPlayerPrivateAVFoundation.h */,
......@@ -19449,9 +19461,8 @@
B1AD4E7713A12A7200846B27 /* track */ = {
isa = PBXGroup;
children = (
0711BF9016430C9000419E36 /* InbandTextTrackPrivate.h */,
0711BF8D1642D9D100419E36 /* InbandTextTrack.cpp */,
0711BF8C1642D81100419E36 /* InbandTextTrack.h */,
0794178F166E855F009416C2 /* InbandTextTrack.cpp */,
07941790166E855F009416C2 /* InbandTextTrack.h */,
9759E93414EF1CF80026A2DD /* LoadableTextTrack.cpp */,
9759E94814EF1D490026A2DD /* LoadableTextTrack.h */,
9759E93514EF1CF80026A2DD /* TextTrack.cpp */,
......@@ -20187,6 +20198,8 @@
A8748D7412CC3F89001FBA41 /* ImageOrientation.cpp */,
A8748D6612CC3763001FBA41 /* ImageOrientation.h */,
49291E4A134172C800E753DE /* ImageRenderingMode.h */,
07941793166EA04E009416C2 /* InbandTextTrackPrivate.h */,
07CE77D416712A6A00C55A47 /* InbandTextTrackPrivateClient.h */,
B27535430B053814002CE64F /* ImageSource.h */,
B27535440B053814002CE64F /* IntPoint.h */,
E462A4A0113E71BE004A4220 /* IntPointHash.h */,
......@@ -21191,6 +21204,8 @@
DF9AFD6F13FC31B00015FEB7 /* objc */ = {
isa = PBXGroup;
children = (
07AA6B69166D019500D45671 /* InbandTextTrackPrivateAVFObjC.h */,
07AA6B6A166D019500D45671 /* InbandTextTrackPrivateAVFObjC.mm */,
DF9AFD7013FC31D80015FEB7 /* MediaPlayerPrivateAVFoundationObjC.h */,
DF9AFD7113FC31D80015FEB7 /* MediaPlayerPrivateAVFoundationObjC.mm */,
CD7E05201651A84100C1201F /* WebCoreAVFResourceLoader.h */,
......@@ -24038,8 +24053,6 @@
B27535710B053814002CE64F /* ImageSource.h in Headers */,
4B3480940EEF50D400AC1B41 /* ImageSourceCG.h in Headers */,
316FE1180E6E1DA700BF6088 /* ImplicitAnimation.h in Headers */,
0711BF8F1642D9F400419E36 /* InbandTextTrack.h in Headers */,
0711BF9116430C9100419E36 /* InbandTextTrackPrivate.h in Headers */,
DB23C2CC0A508D29002489EB /* IndentOutdentCommand.h in Headers */,
F3644B001119805900E0D537 /* InjectedScript.h in Headers */,
AAB6054F15874C58007B5031 /* InjectedScriptBase.h in Headers */,
......@@ -25889,6 +25902,11 @@
31741AAD16636609008A5B7E /* SimulatedClickOptions.h in Headers */,
15B8B7C91652C5220036EF55 /* JSWebKitCSSMixFunctionValue.h in Headers */,
93F72AF31666EDFC002A02BD /* LayerPool.h in Headers */,
07B442D7166C70B000556CAD /* InbandTextTrackPrivateAVF.h in Headers */,
07AA6B6C166D2C1300D45671 /* InbandTextTrackPrivateAVFObjC.h in Headers */,
07CE77D516712A6A00C55A47 /* InbandTextTrackPrivateClient.h in Headers */,
07941792166E855F009416C2 /* InbandTextTrack.h in Headers */,
07941794166EA04E009416C2 /* InbandTextTrackPrivate.h in Headers */,
DEBCCDD216646E8200A452E1 /* RenderMediaControlElements.h in Headers */,
DEBCCDD416646EAF00A452E1 /* MediaControlElementTypes.h in Headers */,
D66817FB166FE6D700FA07B4 /* HTMLTemplateElement.h in Headers */,
......@@ -27259,7 +27277,6 @@
B275355F0B053814002CE64F /* ImageSourceCG.cpp in Sources */,
4B3480930EEF50D400AC1B41 /* ImageSourceCGMac.mm in Sources */,
316FE1170E6E1DA700BF6088 /* ImplicitAnimation.cpp in Sources */,
0711BF8E1642D9D100419E36 /* InbandTextTrack.cpp in Sources */,
DB23C2CB0A508D29002489EB /* IndentOutdentCommand.cpp in Sources */,
F3644AFF1119805900E0D537 /* InjectedScript.cpp in Sources */,
AAB6054E15874C58007B5031 /* InjectedScriptBase.cpp in Sources */,
......@@ -28999,6 +29016,9 @@
86BA766E166427A8005BE5D1 /* FrameLoadRequest.cpp in Sources */,
93F72AF41666EDFC002A02BD /* LayerPool.mm in Sources */,
C375D7FD16639519006184AB /* TypeAhead.cpp in Sources */,
07B442D6166C70B000556CAD /* InbandTextTrackPrivateAVF.cpp in Sources */,
07AA6B6B166D2C0700D45671 /* InbandTextTrackPrivateAVFObjC.mm in Sources */,
07941791166E855F009416C2 /* InbandTextTrack.cpp in Sources */,
D66817FA166FE6D700FA07B4 /* HTMLTemplateElement.cpp in Sources */,
D6489D25166FFCF1007C031B /* JSHTMLTemplateElement.cpp in Sources */,
D6F7960D166FFECE0076DD18 /* JSHTMLTemplateElementCustom.cpp in Sources */,
......@@ -1744,10 +1744,6 @@ void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state)
prepareMediaFragmentURI();
scheduleEvent(eventNames().durationchangeEvent);
scheduleEvent(eventNames().loadedmetadataEvent);
#if ENABLE(VIDEO_TRACK)
if (m_player && m_player->hasClosedCaptions())
processInbandTextTracks();
#endif
if (hasMediaControls())
mediaControls()->loadedMetadata();
if (renderer())
......@@ -2726,48 +2722,64 @@ float HTMLMediaElement::percentLoaded() const
}
#if ENABLE(VIDEO_TRACK)
void HTMLMediaElement::processInbandTextTracks()
void HTMLMediaElement::mediaPlayerDidAddTrack(PassRefPtr<InbandTextTrackPrivate> prpTrack)
{
if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled())
return;
// 4.8.10.12.2 Sourcing in-band text tracks
// 1. Associate the relevant data with a new text track and its corresponding new TextTrack object.
RefPtr<InbandTextTrack> textTrack = InbandTextTrack::create(ActiveDOMObject::scriptExecutionContext(), this, prpTrack);
// 2. Set the new text track's kind, label, and language based on the semantics of the relevant data,
// as defined by the relevant specification. If there is no label in that data, then the label must
// be set to the empty string.
// 3. Associate the text track list of cues with the rules for updating the text track rendering appropriate
// for the format in question.
// 4. If the new text track's kind is metadata, then set the text track in-band metadata track dispatch type
// as follows, based on the type of the media resource:
// 5. Populate the new text track's list of cues with the cues parsed so far, folllowing the guidelines for exposing
// cues, and begin updating it dynamically as necessary.
// - Thess are all done by the media engine.
// 6. Set the new text track's readiness state to loaded.
textTrack->setReadinessState(TextTrack::Loaded);
// 7. Set the new text track's mode to the mode consistent with the user's preferences and the requirements of
// the relevant specification for the data.
// - This will happen in configureTextTracks()
scheduleLoad(TextTrackResource);
// 8. Add the new text track to the media element's list of text tracks.
// 9. Fire an event with the name addtrack, that does not bubble and is not cancelable, and that uses the TrackEvent
// interface, with the track attribute initialized to the text track's TextTrack object, at the media element's
// textTracks attribute's TextTrackList object.
textTracks()->append(textTrack);
}
Vector<RefPtr<InbandTextTrackPrivate> > privateTextTracks;
m_player->getTextTracks(privateTextTracks);
void HTMLMediaElement::mediaPlayerDidRemoveTrack(PassRefPtr<InbandTextTrackPrivate> prpTrack)
{
if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled())
return;
if (!m_textTracks)
return;
if (!privateTextTracks.size())
// This cast is safe because we created the InbandTextTrack with the InbandTextTrackPrivate
// passed to mediaPlayerDidAddTrack.
RefPtr<InbandTextTrack> textTrack = static_cast<InbandTextTrack*>(prpTrack->client());
if (!textTrack)
return;
for (size_t i = 0; i < privateTextTracks.size(); ++i) {
// 4.8.10.12.2 Sourcing in-band text tracks
// 1. Associate the relevant data with a new text track and its corresponding new TextTrack object.
// 2. Set the new text track's kind, label, and language based on the semantics of the relevant data,
// as defined by the relevant specification. If there is no label in that data, then the label must
// be set to the empty string.
// - This is done by the media engine when it creates the InbandTextTrackPrivate.
RefPtr<TextTrack> textTrack = InbandTextTrack::create(ActiveDOMObject::scriptExecutionContext(), this, privateTextTracks[i]);
// 5. Populate the new text track's list of cues with the cues parsed so far, folllowing the guidelines for exposing
// cues, and begin updating it dynamically as necessary.
// - This will happen automatically as the media engine loads the cues
// 6. Set the new text track's readiness state to loaded.
textTrack->setReadinessState(TextTrack::Loaded);
// 7. Set the new text track's mode to the mode consistent with the user's preferences and the requirements of
// the relevant specification for the data.
// - This will happen in configureTextTracks()
// 8. Add the new text track to the media element's list of text tracks.
textTracks()->append(textTrack);
// 9. Fire an event with the name addtrack, that does not bubble and is not cancelable, and that uses the TrackEvent
// interface, with the track attribute initialized to the text track's TextTrack object, at the media element's
// textTracks attribute's TextTrackList object.
// - This was done in TextTrackList::append
m_textTracks->remove(textTrack.get());
TextTrackCueList* cues = textTrack->cues();
if (cues) {
beginIgnoringTrackDisplayUpdateRequests();