haikuwebkit/LayoutTests/media/accessiblity-describes-vide...

33 lines
1.1 KiB
HTML
Raw Permalink Normal View History

[Mac] Audio tracks tagged as 'describes-video' are not automatically selected when that system accessibility option is set. https://bugs.webkit.org/show_bug.cgi?id=145228 Reviewed by Eric Carlson. Source/WebCore: Tests: http/tests/media/hls/hls-accessiblity-describes-video.html media/accessiblity-describes-video.html Add support to CaptionUserPreferences to return the user's preferred audio characteristics, including "public.accessibility.describes-video". When the media accessibility options change, trigger the HTMLMediaElement to update the list of tracks, and chose a new audio track if appropriate. Manually filter those tracks matching the requested characteristics in MediaSelectionGroupAVFObjC. Allow these characteristics to be overrided by Internals for testing purposes. * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::captionPreferencesChanged): Call tracksChanged(). (WebCore::HTMLMediaElement::mediaPlayerPreferredAudioCharacteristics): Pass through to the page's caption preferences. * html/HTMLMediaElement.h: * page/CaptionUserPreferences.cpp: (WebCore::CaptionUserPreferences::setPreferredAudioCharacteristic): Simple setter. (WebCore::CaptionUserPreferences::preferredAudioCharacteristics): Simple getter. * page/CaptionUserPreferences.h: * page/CaptionUserPreferencesMediaAF.cpp: (WebCore::CaptionUserPreferencesMediaAF::~CaptionUserPreferencesMediaAF): Unregister for audio characteristics change notifications. (WebCore::CaptionUserPreferencesMediaAF::setInterestedInCaptionPreferenceChanges): Register for same. (WebCore::CaptionUserPreferencesMediaAF::setPreferredAudioCharacteristic): If in testing mode, pass to superclass; otherwise no-op. (WebCore::CaptionUserPreferencesMediaAF::preferredAudioCharacteristics): If in testing mode, pass to superclass; otherwise, ask the media accessibility framework. * page/CaptionUserPreferencesMediaAF.h: * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::tracksChanged): Pass through to m_private. (WebCore::MediaPlayer::preferredAudioCharacteristics): Pass through to HTMLMediaElement. * platform/graphics/MediaPlayer.h: (WebCore::MediaPlayerClient::mediaPlayerPreferredAudioCharacteristics): Added; return empty vector by default. * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::tracksChanged): Added; no-op by default. * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h: * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm: (WebCore::MediaSelectionGroupAVFObjC::create): Added characteristics parameter. (WebCore::MediaSelectionGroupAVFObjC::MediaSelectionGroupAVFObjC): Ditto. (WebCore::MediaSelectionGroupAVFObjC::updateOptions): Add an additional filter against the passed-in characteristics. * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::determineChangedTracksFromNewTracksAndOldItems): Pass the characteristics to the media selection group. (WebCore::MediaPlayerPrivateAVFoundationObjC::updateAudioTracks): Pass in the user's preferred characteristics. (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoTracks): Pass in an empty vector. * testing/Internals.cpp: (WebCore::Internals::userPreferredAudioCharacteristics): Added; return the current setting. (WebCore::Internals::setUserPreferredAudioCharacteristic): Added; pass through to CaptionUserPreferences. * testing/Internals.h: * testing/Internals.idl: Add soft link macros which account for a possible failure to look up constants. * platform/cf/MediaAccessibilitySoftLink.cpp: * platform/cf/MediaAccessibilitySoftLink.h: * platform/mac/SoftLinking.h: * platform/win/SoftLinking.h: LayoutTests: * http/tests/media/hls/hls-accessiblity-describes-video-expected.txt: Added. * http/tests/media/hls/hls-accessiblity-describes-video.html: Added. * http/tests/media/resources/hls/audio-describes-video.m3u8: Added. * http/tests/media/resources/hls/english/description.aac: Added. * http/tests/media/resources/hls/english/description.m3u8: Added. * media/accessiblity-describes-video-expected.txt: Added. * media/accessiblity-describes-video.html: Added. * media/content/audio-describes-video.mp4: Added. * platform/mac-mavericks/TestExpectations: Canonical link: https://commits.webkit.org/163328@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184799 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-05-22 23:15:37 +00:00
<!DOCTYPE html>
<html>
<head>
<script src="video-test.js"></script>
<script src="media-file.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function start() {
if (window.internals)
internals.setUserPreferredAudioCharacteristic('public.accessibility.describes-video');
findMediaElement();
video = document.getElementById('video');
waitForEvent('canplaythrough', canplaythrough);
video.src = findMediaFile('video', 'content/audio-describes-video');
}
function canplaythrough() {
testExpected('video.audioTracks.length', 2);
testExpected('video.audioTracks[0].enabled', false);
testExpected('video.audioTracks[1].enabled', true);
endTest();
}
</script>
</head>
<body onload="start()">
<video id="video"></video>
</body>
</html>