OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MediaRecorder_h | |
6 #define MediaRecorder_h | |
7 | |
8 #include "core/dom/ActiveDOMObject.h" | |
9 #include "core/events/EventTarget.h" | |
10 #include "modules/EventTargetModules.h" | |
11 #include "modules/mediastream/MediaStream.h" | |
12 #include "modules/ModulesExport.h" | |
13 #include "platform/AsyncMethodRunner.h" | |
14 #include "public/platform/WebMediaRecorderHandler.h" | |
15 #include "public/platform/WebMediaRecorderHandlerClient.h" | |
16 | |
17 namespace blink { | |
18 | |
19 class BlobData; | |
20 class ExceptionState; | |
21 | |
22 class MODULES_EXPORT MediaRecorder final | |
23 : public RefCountedGarbageCollectedEventTargetWithInlineData<MediaRecorder> | |
24 , public WebMediaRecorderHandlerClient | |
25 , public ActiveDOMObject { | |
26 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(MediaRecorder); | |
27 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaRecorder); | |
28 DEFINE_WRAPPERTYPEINFO(); | |
29 public: | |
30 static MediaRecorder* create(ExecutionContext*, MediaStream*, ExceptionState &); | |
31 static MediaRecorder* create(ExecutionContext*, MediaStream*, const String&, ExceptionState&); | |
Peter Beverloo
2015/07/29 16:54:22
What is "const String&"? We do use argument names
mcasas
2015/07/30 13:20:36
Done.
| |
32 | |
33 virtual ~MediaRecorder(); | |
34 | |
35 MediaStream* stream() const { return m_stream.get(); } | |
36 String mimeType() const { return m_mimeType; } | |
37 String state() const { return m_state; } | |
38 | |
39 DEFINE_ATTRIBUTE_EVENT_LISTENER(start); | |
40 DEFINE_ATTRIBUTE_EVENT_LISTENER(stop); | |
41 DEFINE_ATTRIBUTE_EVENT_LISTENER(dataavailable); | |
42 DEFINE_ATTRIBUTE_EVENT_LISTENER(pause); | |
43 DEFINE_ATTRIBUTE_EVENT_LISTENER(resume); | |
44 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | |
45 | |
46 bool ignoreMutedMedia() const { return m_ignoreMutedMedia; } | |
47 void setIgnoreMutedMedia(bool ignoreMutedMedia) { m_ignoreMutedMedia = ignor eMutedMedia; } | |
48 | |
49 void start(ExceptionState&); | |
50 void start(int&, ExceptionState&); | |
Peter Beverloo
2015/07/29 16:54:22
dito re: argument meaning, for int&
mcasas
2015/07/30 13:20:36
Done.
| |
51 void stop(ExceptionState&); | |
52 void pause(ExceptionState&); | |
53 void resume(ExceptionState&); | |
54 void requestData(ExceptionState&); | |
55 | |
56 static String canRecordMimeType(const String&); | |
Peter Beverloo
2015/07/29 16:54:22
dito re: argument meaning, for String&
mcasas
2015/07/30 13:20:36
Done.
| |
57 | |
58 // EventTarget | |
59 virtual const AtomicString& interfaceName() const override; | |
60 virtual ExecutionContext* executionContext() const override; | |
61 | |
62 // ActiveDOMObject | |
63 virtual void suspend() override; | |
64 virtual void resume() override; | |
65 virtual void stop() override; | |
66 virtual bool hasPendingActivity() const override { return !m_stopped; } | |
67 | |
68 // WebMediaRecorderHandlerClient | |
69 virtual void writeData(const char* data, size_t length, bool lastInSlice) ov erride; | |
70 virtual void failOutOfMemory(const WebString& message) override; | |
71 virtual void failIllegalStreamModification(const WebString& message) overrid e; | |
72 virtual void failOtherRecordingError(const WebString& message) override; | |
73 | |
74 DECLARE_VIRTUAL_TRACE(); | |
75 | |
76 private: | |
77 MediaRecorder(ExecutionContext*, MediaStream*, const String&, ExceptionState &); | |
78 | |
79 void createBlobEvent(PassOwnPtr<BlobData> blobData); | |
80 | |
81 void doStop(); | |
82 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); | |
83 void dispatchScheduledEvent(); | |
84 | |
85 Member<MediaStream> m_stream; | |
86 bool m_stopped; | |
87 String m_mimeType; | |
88 String m_state; | |
Peter Beverloo
2015/07/29 16:54:22
I'm not a huge fan of using a String to maintain t
mcasas
2015/07/30 13:20:36
Done.
I noticed that there's a textual String rep
| |
89 bool m_ignoreMutedMedia; | |
90 | |
91 OwnPtr<WebMediaRecorderHandler> m_recorderHandler; | |
92 | |
93 AsyncMethodRunner<MediaRecorder> m_dispatchScheduledEventRunner; | |
94 WillBeHeapVector<RefPtrWillBeMember<Event>> m_scheduledEvents; | |
95 }; | |
96 | |
97 } // namespace blink | |
98 | |
99 #endif // MediaRecorder_h | |
OLD | NEW |