Re: [mediacapture-main] Clarification needed on HTMLMediaElement attributes that carry over (#599)

> Here is my take on jsfiddle: https://jsfiddle.net/sdjq3Laf/ adding a bunch of setTimeout everywhere.
> Chrome and Safari have the same behavior in that case. Safari checks for detecting a MediaStream srcObject is not kicking synchronously.

We should define when this check for a MediaStream starts and stops being valid. I suggest we make it synchronous in the srcObject setter, because of this example:
```
let v = document.createElemenet("video");
v.srcObject = await navigator.mediaDevices.getUserMedia({video: true});
v.play();
await new Promise(r => setTimeout(r, 1000));
v.srcObject = null;
v.src = mediaFileUrl;
v.load(); // runs the load algorithm, which synchronously sets playbackRate to defaultPlaybackRate
```

> When setting srcObject to MediaStream, the playbackRate is changed from 0.6 to 1, but no corresponding ratechange event is fired.
> This seems to go well with your initial interpretation.
> 
> It seems slightly better to state that on setting srcObject, playbackRate is set to 1, which would then trigger an event (though the html media spec is fuzzy there) if it was not equal to 1 initially.

I don't find it fuzzy. If you set `playbackRate` to a new value and then run the load algorithm, the "ratechange" event is cancelled. If you set it after having run the load algorithm, "ratechange" is not cancelled (unless the load algorithm runs again before "ratechange" is dispatched). Setting `srcObject` synchronously runs the load algorithm, so if we want to refer to setting these attributes in the `srcObject` setter, we need to say whether they should be set before or after running the load algorithm. Note that doing it after the load algorithm could lead to 3 "ratechange" events:
1) playbackRate = defaultPlaybackRate per the load algorithm
2) defaultPlaybackRate = 1
3) playbackRate = 1

How much trouble would it be to define the special cases of these attributes in the media element spec instead?

-- 
GitHub Notification of comment by Pehrsons
Please view or discuss this issue at https://github.com/w3c/mediacapture-main/issues/599#issuecomment-498211595 using your GitHub account

Received on Monday, 3 June 2019 11:00:57 UTC