Diff
Modified: trunk/LayoutTests/ChangeLog (263895 => 263896)
--- trunk/LayoutTests/ChangeLog 2020-07-03 14:31:56 UTC (rev 263895)
+++ trunk/LayoutTests/ChangeLog 2020-07-03 14:55:10 UTC (rev 263896)
@@ -1,3 +1,13 @@
+2020-07-03 Youenn Fablet <you...@apple.com>
+
+ Support MediaRecorder.onstart
+ https://bugs.webkit.org/show_bug.cgi?id=213720
+
+ Reviewed by Darin Adler.
+
+ * http/wpt/mediarecorder/MediaRecorder-start-timeSlice-expected.txt:
+ * http/wpt/mediarecorder/MediaRecorder-start-timeSlice.html:
+
2020-07-03 Carlos Garcia Campos <cgar...@igalia.com>
REGRESSION(r261779): [GTK][WPE] http/tests/resourceLoadStatistics/third-party-cookie-blocking-ephemeral.html is failing
Modified: trunk/LayoutTests/http/wpt/mediarecorder/MediaRecorder-start-timeSlice-expected.txt (263895 => 263896)
--- trunk/LayoutTests/http/wpt/mediarecorder/MediaRecorder-start-timeSlice-expected.txt 2020-07-03 14:31:56 UTC (rev 263895)
+++ trunk/LayoutTests/http/wpt/mediarecorder/MediaRecorder-start-timeSlice-expected.txt 2020-07-03 14:55:10 UTC (rev 263896)
@@ -1,3 +1,4 @@
PASS Make sure that MediaRecorder timeSlice triggers regular ondataavailable events
+PASS Make sure that MediaRecorder fires onstart on successful start call
Modified: trunk/LayoutTests/http/wpt/mediarecorder/MediaRecorder-start-timeSlice.html (263895 => 263896)
--- trunk/LayoutTests/http/wpt/mediarecorder/MediaRecorder-start-timeSlice.html 2020-07-03 14:31:56 UTC (rev 263895)
+++ trunk/LayoutTests/http/wpt/mediarecorder/MediaRecorder-start-timeSlice.html 2020-07-03 14:55:10 UTC (rev 263896)
@@ -23,6 +23,22 @@
promise = new Promise(resolve => recorder._ondataavailable_ = resolve);
await promise;
}, 'Make sure that MediaRecorder timeSlice triggers regular ondataavailable events');
+
+ promise_test(async t => {
+ const video = await navigator.mediaDevices.getUserMedia({ audio : true, video : true });
+ const recorder = new MediaRecorder(video);
+
+ let isStarted = false;
+ let promise = new Promise(resolve => recorder._onstart_ = () => {
+ isStarted = true;
+ resolve();
+ });
+ // We cover the case of invalid ignored timeSlice value by passing -1 here.
+ recorder.start(-1);
+ assert_false(isStarted);
+
+ return promise;
+ }, 'Make sure that MediaRecorder fires onstart on successful start call');
</script>
</body>
</html>
Modified: trunk/Source/WebCore/ChangeLog (263895 => 263896)
--- trunk/Source/WebCore/ChangeLog 2020-07-03 14:31:56 UTC (rev 263895)
+++ trunk/Source/WebCore/ChangeLog 2020-07-03 14:55:10 UTC (rev 263896)
@@ -1,5 +1,21 @@
2020-07-03 Youenn Fablet <you...@apple.com>
+ Support MediaRecorder.onstart
+ https://bugs.webkit.org/show_bug.cgi?id=213720
+
+ Reviewed by Darin Adler.
+
+ Fire start event if MediaRecorder.start is successful.
+ Do some WebIDL clean-up, in particular change timeSlice from long to unsigned long, as per spec.
+ Covered by added test.
+
+ * Modules/mediarecorder/MediaRecorder.cpp:
+ (WebCore::MediaRecorder::startRecording):
+ * Modules/mediarecorder/MediaRecorder.h:
+ * Modules/mediarecorder/MediaRecorder.idl:
+
+2020-07-03 Youenn Fablet <you...@apple.com>
+
MediaRecorder.start() Method is Ignoring the "timeslice" Parameter
https://bugs.webkit.org/show_bug.cgi?id=202233
<rdar://problem/55720555>
Modified: trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp (263895 => 263896)
--- trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp 2020-07-03 14:31:56 UTC (rev 263895)
+++ trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.cpp 2020-07-03 14:55:10 UTC (rev 263896)
@@ -126,7 +126,7 @@
return "MediaRecorder";
}
-ExceptionOr<void> MediaRecorder::startRecording(Optional<int> timeSlice)
+ExceptionOr<void> MediaRecorder::startRecording(Optional<unsigned> timeSlice)
{
if (!m_isActive)
return Exception { InvalidStateError, "The MediaRecorder is not active"_s };
@@ -141,11 +141,24 @@
return Exception { NotSupportedError, "The MediaRecorder is unsupported on this platform"_s };
m_private->startRecording([this, pendingActivity = makePendingActivity(*this)](auto&& exception) mutable {
- if (!m_isActive || !exception)
+ if (!m_isActive)
return;
- stopRecordingInternal();
- dispatchError(WTFMove(*exception));
+ if (exception) {
+ stopRecordingInternal();
+ queueTaskKeepingObjectAlive(*this, TaskSource::Networking, [this, exception = WTFMove(*exception)]() mutable {
+ if (!m_isActive)
+ return;
+ dispatchError(WTFMove(exception));
+ });
+ return;
+ }
+
+ queueTaskKeepingObjectAlive(*this, TaskSource::Networking, [this] {
+ if (!m_isActive)
+ return;
+ dispatchEvent(Event::create(eventNames().startEvent, Event::CanBubble::No, Event::IsCancelable::No));
+ });
});
for (auto& track : m_tracks)
Modified: trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.h (263895 => 263896)
--- trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.h 2020-07-03 14:31:56 UTC (rev 263895)
+++ trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.h 2020-07-03 14:55:10 UTC (rev 263896)
@@ -69,7 +69,7 @@
using RefCounted::ref;
using RefCounted::deref;
- ExceptionOr<void> startRecording(Optional<int>);
+ ExceptionOr<void> startRecording(Optional<unsigned>);
ExceptionOr<void> stopRecording();
ExceptionOr<void> requestData();
@@ -117,7 +117,7 @@
std::unique_ptr<MediaRecorderPrivate> m_private;
RecordingState m_state { RecordingState::Inactive };
Vector<Ref<MediaStreamTrackPrivate>> m_tracks;
- Optional<int> m_timeSlice;
+ Optional<unsigned> m_timeSlice;
Timer m_timeSliceTimer;
bool m_isActive { true };
Modified: trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.idl (263895 => 263896)
--- trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.idl 2020-07-03 14:31:56 UTC (rev 263895)
+++ trunk/Source/WebCore/Modules/mediarecorder/MediaRecorder.idl 2020-07-03 14:55:10 UTC (rev 263896)
@@ -32,11 +32,12 @@
] interface MediaRecorder : EventTarget {
[CallWith=Document, MayThrowException] constructor(MediaStream stream, optional MediaRecorderOptions options);
- readonly attribute RecordingState state;
+ // FIXME: Implement commented out methods/attributes.
+
readonly attribute MediaStream stream;
- // FIXME: Implement these:
// readonly attribute DOMString mimeType;
- // attribute EventHandler onstart;
+ readonly attribute RecordingState state;
+ attribute EventHandler onstart;
attribute EventHandler onstop;
attribute EventHandler ondataavailable;
// attribute EventHandler onpause;
@@ -44,8 +45,9 @@
attribute EventHandler onerror;
// readonly attribute unsigned long videoBitsPerSecond;
// readonly attribute unsigned long audioBitsPerSecond;
+ // readonly attribute BitrateMode audioBitrateMode;
- [MayThrowException, ImplementedAs=startRecording] void start(optional long timeslice);
+ [MayThrowException, ImplementedAs=startRecording] void start(optional unsigned long timeslice);
[ImplementedAs=stopRecording] void stop();
// void pause();
// void resume();