Re: requestShowMedia.js - A Presentation API prollyfill for the HTMLMediaElement

Hi Anssi,

Great demo! One question, see inline.

On 2014-06-17 15:48, Kostiainen, Anssi wrote:
> Hi All,
>
> In the spirit of experimentation I wrote a Presentation API prollyfill (= a polyfill for a not yet standardized API) for the HTMLMediaElement to get a feel of the API ergonomics.
>
> The demo is at (tested with the latest desktop Chrome, Firefox, Safari):
>
>    http://webscreens.github.io/requestshowmedia/demo/
>
> The video files used in the demo are hosted on GitHub pages too, so don’t expect blazingly fast download speeds. If the demo misbehaves, try a more modern browser :-)
>
> For more information, please consult the GitHub repo at:
>
>    https://github.com/webscreens/requestshowmedia
>
> Here’s what this is about:
>
> Using the requestShowMedia.js prollyfill you can display any <video> contained on a web page on a second screen and control its playback using the standard HTMLMediaElement methods play(), pause(), and fastSeek(time).
>
> The demo works in modern browsers by emulating a second screen using a new window. If an experimental Chromium build is used (see the demo page or the GH repo for details on how to get one) the video is displayed on a real second screen.
>
> In terms of code, this is how a web developer might use the API:
>
> <script>
> var v = document.querySelector('video');
>
> // Display the video on a second screen.
> v.requestShow();
>
> // Use the standard HTMLMediaElement methods to control the playback.
> v.play();
> v.pause();
> v.fastSeek(time);
> </script>

With that proposal, adding support for second screen video playback is 
really just a matter of adding a UI "project" button and binding it to a 
call to "requestShow". That's 3 additional lines of code without having 
to touch the rest. Nice!

In the demo code [1], is there a reason for "requestShow" to return a 
pointer to the second screen (or a Promise to get that second screen)? 
The only need seems to be to close the show, but that could e.g. be 
handled with a call to an hypothetical "v.exitShow" function, which 
would avoid introducing another construct, and be somewhat consistent 
with the approach taken by the FullScreen API.

Francois.

[1] 
https://github.com/webscreens/requestshowmedia/blob/gh-pages/demo/index.html#L40

Received on Monday, 30 June 2014 10:31:00 UTC