| Index: Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp
|
| diff --git a/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp b/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp
|
| index 4bf8eab1268fdbbe30feddd961c7c9f090cfb7f1..28217beec897734d1ac69ccb7cf08fcad5c047e1 100644
|
| --- a/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp
|
| +++ b/Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.cpp
|
| @@ -248,6 +248,7 @@ void SetMediaKeysHandler::trace(Visitor* visitor)
|
|
|
| HTMLMediaElementEncryptedMedia::HTMLMediaElementEncryptedMedia()
|
| : m_emeMode(EmeModeNotSelected)
|
| + , m_waitingForKey(false)
|
| {
|
| }
|
|
|
| @@ -536,6 +537,44 @@ void HTMLMediaElementEncryptedMedia::encrypted(HTMLMediaElement& element, const
|
| }
|
| }
|
|
|
| +void HTMLMediaElementEncryptedMedia::waitingForKey(HTMLMediaElement& element)
|
| +{
|
| + WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::waitingForKey");
|
| +
|
| + // From https://w3c.github.io/encrypted-media/#queue-waitingforkey:
|
| + // It should only be called when the HTMLMediaElement object is potentially
|
| + // playing and its readyState is equal to HAVE_FUTURE_DATA or greater.
|
| + // FIXME: Is this really required?
|
| +
|
| + // 1. Let the media element be the specified HTMLMediaElement object.
|
| + HTMLMediaElementEncryptedMedia& thisElement = HTMLMediaElementEncryptedMedia::from(element);
|
| +
|
| + // 2. If the media element's waiting for key value is false, queue a task
|
| + // to fire a simple event named waitingforkey at the media element.
|
| + if (!thisElement.m_waitingForKey) {
|
| + RefPtrWillBeRawPtr<Event> event = Event::create(EventTypeNames::waitingforkey);
|
| + event->setTarget(&element);
|
| + element.scheduleEvent(event.release());
|
| + }
|
| +
|
| + // 3. Set the media element's waiting for key value to true.
|
| + thisElement.m_waitingForKey = true;
|
| +
|
| + // 4. Suspend playback.
|
| + // (Already done on the Chromium side by the decryptors.)
|
| +}
|
| +
|
| +void HTMLMediaElementEncryptedMedia::playbackResumedAfterKey(HTMLMediaElement& element)
|
| +{
|
| + WTF_LOG(Media, "HTMLMediaElementEncryptedMedia::playbackResumedAfterKey");
|
| +
|
| + // Logic is on the Chromium side to attempt to resume playback when a new
|
| + // key is available. However, |m_waitingForKey| needs to be cleared so that
|
| + // a later waitingForKey() call can generate the event.
|
| + HTMLMediaElementEncryptedMedia& thisElement = HTMLMediaElementEncryptedMedia::from(element);
|
| + thisElement.m_waitingForKey = false;
|
| +}
|
| +
|
| void HTMLMediaElementEncryptedMedia::playerDestroyed(HTMLMediaElement& element)
|
| {
|
| #if ENABLE(OILPAN)
|
|
|