Skip to content
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

Promises resolution not defined #463

Closed
murillo128 opened this issue Apr 11, 2016 · 5 comments
Closed

Promises resolution not defined #463

murillo128 opened this issue Apr 11, 2016 · 5 comments

Comments

@murillo128
Copy link

Several methods of the ORTC objects return a promise, but it is not defined when they are resolved nor what value is it resolved to.

For example:

setTrack
Attempts to replace the track being sent with another track provided.

When the setTrack() method is invoked, the user agent must run the following steps:

1. Let p be a new promise.

2. Let withTrack be the argument to this method.

3. Run the following steps asynchronously:

    1. If withTrack.kind differs from RTCRtpSender.track.kind or if withTrack has different peerIdentity constraints, then reject p with IncompatibleMediaStreamTrackError and abort these steps.
    2. If withTrack.readyState is "ended" then reject p with IncompatibleMediaStreamTrackError and abort these steps.
    3. Set the RTCRtpSender.track attribute to withTrack, and have the sender seamlessly switch to transmitting withTrack in place of what it is sending. On the remote receiving end, the track maintains its existing grouping and id until the connection ends.

It is assumed that the the promise will be resolved on async-3 step with an undefined (?) value, but this should be explicitly said, as for example:

3. Run the following steps asynchronously:

    1. If withTrack.kind differs from RTCRtpSender.track.kind or if withTrack has different peerIdentity constraints, then reject p with IncompatibleMediaStreamTrackError and abort these steps.
    2. If withTrack.readyState is "ended" then reject p with IncompatibleMediaStreamTrackError and abort these steps.
    3. Set the RTCRtpSender.track attribute to withTrack, and have the sender seamlessly switch to transmitting withTrack in place of what it is sending. On the remote receiving end, the track maintains its existing grouping and id until the connection ends.
    4. Resolve p with withTrack value
@murillo128
Copy link
Author

Also we should add the promise resolved value in the definition, changing:

Promise                   setTrack (MediaStreamTrack track);

by

Promise<void>                  setTrack (MediaStreamTrack track);

@robin-raymond
Copy link
Contributor

Currently, when a promise is not returning a specific value we just return Promise. The IDL will need to be verified to ensure the correct practices are followed for all promises.

@murillo128
Copy link
Author

Here is the w3c best practices guide on promises:

https://www.w3.org/2001/tag/doc/promises-guide
El 13/4/2016 23:22, "Robin Raymond" notifications@github.com escribió:

Currently, when a promise is not returning a specific value we just return
Promise. The IDL will need to be verified to ensure the correct practices
are followed for all promises.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#463 (comment)

@robin-raymond
Copy link
Contributor

Correct, 7.4 has examples as such:

interface ProtectedResource {
  Promise<void> requestAccess();
  // ...
};

@robin-raymond
Copy link
Contributor

Looks better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants