Skip to content

Add interface mixin KeyFrameRequest to simplify #270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -885,18 +885,22 @@ partial interface DedicatedWorkerGlobalScope {
attribute EventHandler onrtctransform;
};

interface mixin KeyFrameRequest {
Promise<undefined> generateKeyFrame(optional DOMString rid);
};

[Exposed=DedicatedWorker]
interface RTCRtpScriptTransformer : EventTarget {
// Attributes and methods related to the transformer source
readonly attribute ReadableStream readable;
Promise<unsigned long long> generateKeyFrame(optional DOMString rid);
Promise<undefined> sendKeyFrameRequest();
// Attributes and methods related to the transformer sink
readonly attribute WritableStream writable;
attribute EventHandler onkeyframerequest;
// Attributes for configuring the Javascript code
readonly attribute any options;
};
RTCRtpScriptTransformer includes KeyFrameRequest;

[Exposed=Window]
interface RTCRtpScriptTransform {
Expand Down Expand Up @@ -941,11 +945,6 @@ Each RTCRtpScriptTransform has the following set of [$association steps$], given
1. Set |transformer|.`[[encoder]]` to |encoder|.
1. Set |transformer|.`[[depacketizer]]` to |depacketizer|.

The <dfn method for="RTCRtpScriptTransform">generateKeyFrame(|rid|)</dfn> method steps are:
1. Let |promise| be a new promise.
1. Run the [$generate key frame algorithm$] with |promise|, |this|.`[[encoder]]` and |rid|.
1. Return |promise|.

The <dfn method for="RTCRtpScriptTransform">sendKeyFrameRequest()</dfn> method steps are:
1. Let |promise| be a new promise.
1. Run the [$send request key frame algorithm$] with |promise| and |this|.`[[depacketizer]]`.
Expand Down Expand Up @@ -988,6 +987,13 @@ or Full Intra Refresh (FIR), queue a task to perform the following steps:
1. If the event's [=Event/canceled flag=] is true, abort these steps.
1. Run the [$generate key frame algorithm$] with a new promise, |transform|.`[[encoder]]` and |rid|.

## KeyFrameRequest Operations ## {#KeyFrameRequest-operations}

The <dfn method for="KeyFrameRequest">generateKeyFrame(|rid|)</dfn> method steps are:
1. Let |promise| be a new promise.
1. Run the [$generate key frame algorithm$] with |promise|, |this|.`[[encoder]]` and |rid|.
1. Return |promise|.

## KeyFrame Algorithms ## {#KeyFrame-algorithms}

The <dfn abstract-op>generate key frame algorithm</dfn>, given |promise|, |encoder| and |rid|, is defined by running these steps:
Expand Down Expand Up @@ -1038,19 +1044,9 @@ The <dfn abstract-op>send request key frame algorithm</dfn>, given |promise| and
An additional API on {{RTCRtpSender}} is added to complement the generation of key frame added to {{RTCRtpScriptTransformer}}.

<pre class="idl">
partial interface RTCRtpSender {
Promise&lt;undefined&gt; generateKeyFrame(optional sequence &lt;DOMString&gt; rids);
};
RTCRtpSender includes KeyFrameRequest;
</pre>

## Extension operation ## {#sender-operation}

The <dfn method for="RTCRtpSender">generateKeyFrame(|rids|)</dfn> method steps are:

1. Let |promise| be a new promise.
1. [=In parallel=], run the [$generate key frame algorithm$] with |promise|, |this|'s encoder and |rids|.
1. Return |promise|.

# Privacy and security considerations # {#privacy}

This API gives Javascript access to the content of media streams. This
Expand Down