haikuwebkit/LayoutTests/fast/mediastream/local-audio-playing-event.html

31 lines
1.1 KiB
HTML
Raw Permalink Normal View History

Local audio-only stream will not trigger playback to begin https://bugs.webkit.org/show_bug.cgi?id=168412 Reviewed by Youenn Fablet. Source/WebCore: Test: fast/mediastream/local-audio-playing-event.html With video-bearing streams, the first video sample emitted from the stream causes the readyState to move from HAVE_NOTHING to HAVE_ENOUGH_DATA. Wire up this same behavior for audio-bearing streams. Add a MediaStreamTrackPrivate::Observer callback method audioSamplesAvailable(), which gets passed up to MediaPlayerPrivateMediaStreamAVFObjC. Because this callback may be (and probably will be) called on a background thread, run the updateReadyState() task in a scheduledDeferredTask(). * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::audioSamplesAvailable): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks): * platform/mediastream/MediaStreamTrackPrivate.cpp: (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable): * platform/mediastream/MediaStreamTrackPrivate.h: (WebCore::MediaStreamTrackPrivate::Observer::audioSamplesAvailable): LayoutTests: * fast/mediastream/local-audio-playing-event-expected.txt: Added. * fast/mediastream/local-audio-playing-event.html: Added. Canonical link: https://commits.webkit.org/185634@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212696 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-21 02:35:35 +00:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Testing local audio capture playback causes "playing" event to fire</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
</head>
<body>
<audio id="audio" autoplay></audio>
<audio id="audioNoAutoplay" autoplay></audio>
Local audio-only stream will not trigger playback to begin https://bugs.webkit.org/show_bug.cgi?id=168412 Reviewed by Youenn Fablet. Source/WebCore: Test: fast/mediastream/local-audio-playing-event.html With video-bearing streams, the first video sample emitted from the stream causes the readyState to move from HAVE_NOTHING to HAVE_ENOUGH_DATA. Wire up this same behavior for audio-bearing streams. Add a MediaStreamTrackPrivate::Observer callback method audioSamplesAvailable(), which gets passed up to MediaPlayerPrivateMediaStreamAVFObjC. Because this callback may be (and probably will be) called on a background thread, run the updateReadyState() task in a scheduledDeferredTask(). * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::audioSamplesAvailable): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks): * platform/mediastream/MediaStreamTrackPrivate.cpp: (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable): * platform/mediastream/MediaStreamTrackPrivate.h: (WebCore::MediaStreamTrackPrivate::Observer::audioSamplesAvailable): LayoutTests: * fast/mediastream/local-audio-playing-event-expected.txt: Added. * fast/mediastream/local-audio-playing-event.html: Added. Canonical link: https://commits.webkit.org/185634@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212696 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-21 02:35:35 +00:00
<script>
if (window.testRunner)
testRunner.setUserMediaPermission(true);
promise_test(async (test) => {
audio.srcObject = await navigator.mediaDevices.getUserMedia({audio: true});
var eventWatcher = new EventWatcher(test, audio, 'playing');
return eventWatcher.wait_for('playing');
Local audio-only stream will not trigger playback to begin https://bugs.webkit.org/show_bug.cgi?id=168412 Reviewed by Youenn Fablet. Source/WebCore: Test: fast/mediastream/local-audio-playing-event.html With video-bearing streams, the first video sample emitted from the stream causes the readyState to move from HAVE_NOTHING to HAVE_ENOUGH_DATA. Wire up this same behavior for audio-bearing streams. Add a MediaStreamTrackPrivate::Observer callback method audioSamplesAvailable(), which gets passed up to MediaPlayerPrivateMediaStreamAVFObjC. Because this callback may be (and probably will be) called on a background thread, run the updateReadyState() task in a scheduledDeferredTask(). * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::audioSamplesAvailable): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks): * platform/mediastream/MediaStreamTrackPrivate.cpp: (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable): * platform/mediastream/MediaStreamTrackPrivate.h: (WebCore::MediaStreamTrackPrivate::Observer::audioSamplesAvailable): LayoutTests: * fast/mediastream/local-audio-playing-event-expected.txt: Added. * fast/mediastream/local-audio-playing-event.html: Added. Canonical link: https://commits.webkit.org/185634@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212696 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-21 02:35:35 +00:00
}, 'Local audio playback fires playing event');
promise_test(async (test) => {
audioNoAutoplay.srcObject = await navigator.mediaDevices.getUserMedia({audio: true});
audioNoAutoplay.play();
var eventWatcher = new EventWatcher(test, audioNoAutoplay, 'playing');
return eventWatcher.wait_for('playing');
}, 'Calling play synchronously after setting srcObject shoud play and fire playing event');
Local audio-only stream will not trigger playback to begin https://bugs.webkit.org/show_bug.cgi?id=168412 Reviewed by Youenn Fablet. Source/WebCore: Test: fast/mediastream/local-audio-playing-event.html With video-bearing streams, the first video sample emitted from the stream causes the readyState to move from HAVE_NOTHING to HAVE_ENOUGH_DATA. Wire up this same behavior for audio-bearing streams. Add a MediaStreamTrackPrivate::Observer callback method audioSamplesAvailable(), which gets passed up to MediaPlayerPrivateMediaStreamAVFObjC. Because this callback may be (and probably will be) called on a background thread, run the updateReadyState() task in a scheduledDeferredTask(). * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::audioSamplesAvailable): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks): * platform/mediastream/MediaStreamTrackPrivate.cpp: (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable): * platform/mediastream/MediaStreamTrackPrivate.h: (WebCore::MediaStreamTrackPrivate::Observer::audioSamplesAvailable): LayoutTests: * fast/mediastream/local-audio-playing-event-expected.txt: Added. * fast/mediastream/local-audio-playing-event.html: Added. Canonical link: https://commits.webkit.org/185634@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212696 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-21 02:35:35 +00:00
</script>
</body>
</html>