| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/mediacapturefromelement/HTMLMediaElementCapture.h" | 5 #include "modules/mediacapturefromelement/HTMLMediaElementCapture.h" |
| 6 | 6 |
| 7 #include "core/dom/ExceptionCode.h" | 7 #include "core/dom/ExceptionCode.h" |
| 8 #include "core/html/HTMLMediaElement.h" | 8 #include "core/html/HTMLMediaElement.h" |
| 9 #include "modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h" | 9 #include "modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h" |
| 10 #include "modules/encryptedmedia/MediaKeys.h" | 10 #include "modules/encryptedmedia/MediaKeys.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 // Avoid capturing from EME-protected Media Elements. | 29 // Avoid capturing from EME-protected Media Elements. |
| 30 if (HTMLMediaElementEncryptedMedia::mediaKeys(element)) { | 30 if (HTMLMediaElementEncryptedMedia::mediaKeys(element)) { |
| 31 // This exception is not defined in the spec, see https://github.com/w3c
/mediacapture-fromelement/issues/20. | 31 // This exception is not defined in the spec, see https://github.com/w3c
/mediacapture-fromelement/issues/20. |
| 32 exceptionState.throwDOMException(NotSupportedError, "Stream capture not
supported with EME"); | 32 exceptionState.throwDOMException(NotSupportedError, "Stream capture not
supported with EME"); |
| 33 return nullptr; | 33 return nullptr; |
| 34 } | 34 } |
| 35 | 35 |
| 36 // If |element| is actually playing a MediaStream, just clone it. | 36 // If |element| is actually playing a MediaStream, just clone it. |
| 37 if (HTMLMediaElement::isMediaStreamURL(element.currentSrc().getString())) { | 37 if (HTMLMediaElement::isMediaStreamURL(element.currentSrc().getString())) { |
| 38 return MediaStream::create(element.executionContext(), MediaStreamRegist
ry::registry().lookupMediaStreamDescriptor(element.currentSrc().getString())); | 38 return MediaStream::create(element.getExecutionContext(), MediaStreamReg
istry::registry().lookupMediaStreamDescriptor(element.currentSrc().getString()))
; |
| 39 } | 39 } |
| 40 | 40 |
| 41 // TODO(mcasas): Only <video> tags are supported at the moment. | 41 // TODO(mcasas): Only <video> tags are supported at the moment. |
| 42 if (element.isHTMLAudioElement()) { | 42 if (element.isHTMLAudioElement()) { |
| 43 notImplemented(); | 43 notImplemented(); |
| 44 return nullptr; | 44 return nullptr; |
| 45 } | 45 } |
| 46 | 46 |
| 47 WebMediaStream webStream; | 47 WebMediaStream webStream; |
| 48 webStream.initialize(WebVector<WebMediaStreamTrack>(), WebVector<WebMediaStr
eamTrack>()); | 48 webStream.initialize(WebVector<WebMediaStreamTrack>(), WebVector<WebMediaStr
eamTrack>()); |
| 49 MediaStreamCenter::instance().didCreateMediaStream(webStream); | 49 MediaStreamCenter::instance().didCreateMediaStream(webStream); |
| 50 | 50 |
| 51 Platform::current()->createHTMLVideoElementCapturer(&webStream, element.webM
ediaPlayer()); | 51 Platform::current()->createHTMLVideoElementCapturer(&webStream, element.webM
ediaPlayer()); |
| 52 return MediaStream::create(element.executionContext(), webStream); | 52 return MediaStream::create(element.getExecutionContext(), webStream); |
| 53 } | 53 } |
| 54 | 54 |
| 55 } // namespace blink | 55 } // namespace blink |
| OLD | NEW |