#include "third_party/blink/renderer/modules/mediacapturefromelement/html_media_element_capture.h"
#include "base/memory/ptr_util.h"
#include "base/task/single_thread_task_runner.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "third_party/blink/public/mojom/mediastream/media_devices.mojom-blink.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/web/modules/mediastream/media_stream_video_source.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/core/dom/events/native_event_listener.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/html/media/html_media_element.h"
#include "third_party/blink/renderer/core/html/track/audio_track_list.h"
#include "third_party/blink/renderer/core/html/track/video_track_list.h"
#include "third_party/blink/renderer/modules/encryptedmedia/html_media_element_encrypted_media.h"
#include "third_party/blink/renderer/modules/encryptedmedia/media_keys.h"
#include "third_party/blink/renderer/modules/mediacapturefromelement/html_audio_element_capturer_source.h"
#include "third_party/blink/renderer/modules/mediacapturefromelement/html_video_element_capturer_source.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream_utils.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream_video_capturer_source.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream_video_track.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_audio_source.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_audio_track.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_component_impl.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_descriptor.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_source.h"
#include "third_party/blink/renderer/platform/wtf/uuid.h"
namespace blink {
namespace {
bool AddVideoTrackToMediaStream(
LocalFrame* frame,
std::unique_ptr<VideoCapturerSource> video_source,
bool is_remote,
MediaStreamDescriptor* descriptor) { … }
void CreateHTMLVideoElementCapturer(
LocalFrame* frame,
MediaStreamDescriptor* descriptor,
WebMediaPlayer* web_media_player,
scoped_refptr<base::SingleThreadTaskRunner> task_runner) { … }
void CreateHTMLAudioElementCapturer(
LocalFrame*,
MediaStreamDescriptor* descriptor,
WebMediaPlayer* web_media_player,
scoped_refptr<base::SingleThreadTaskRunner> task_runner) { … }
class MediaElementEventListener final : public NativeEventListener { … };
MediaElementEventListener::MediaElementEventListener(HTMLMediaElement* element,
MediaStream* stream)
: … { … }
void MediaElementEventListener::Invoke(ExecutionContext* context,
Event* event) { … }
void DidStopMediaStreamSource(MediaStreamSource* source) { … }
void MediaElementEventListener::UpdateSources(ExecutionContext* context) { … }
void MediaElementEventListener::Trace(Visitor* visitor) const { … }
}
MediaStream* HTMLMediaElementCapture::captureStream(
ScriptState* script_state,
HTMLMediaElement& element,
ExceptionState& exception_state) { … }
}