8000 GitHub - richtr/universal-remote-control-access: A demonstration of how web apps can access media-centric remote control events to control any other web content
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

richtr/universal-remote-control-access

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Using media-based remote control events to control any in-page web content

This library allows web developers to obtain low-level access to remote control events to control any kind of web content such as Flash-based media, presentations, slide shows or Web Audio API content based on the assumption that platform-level media focus can be obtained via HTMLMediaElement objects (related discussion: WHATWG Media Keys and Media Focus).

Usage

To obtain low-level access to remote control events from a web page you can do the following:

  1. Create a new RemoteControls object with the required duration for remote control focus and a callback to be run when the object has been fully initialized: javascript var controls = new RemoteControls(300, readyCallback);

  2. Start the RemoteControls object when you are ready to obtain remote controls focus: javascript function readyCallback() { controls.start(); }

  3. Listen for remote control events and wire these up to your web content however you wish: javascript controls. {}; controls. {}; controls. {}; // etc ... for 'seekchange', 'volumechange', 'previousbuttonpressed' // and 'nextbuttonpressed' events controls. {};

  4. Use the remote control events to drive whatever web content you wish such as Web Audio API content, Flash-based media, presentations or slide shows.

How it works under the hood

We create a dummy <audio> element and generate a silent WAV file of any length on the client-side to playback using JavaScript. Producing a silent WAV to use in this dummy element is very inexpensive and fast to generate on the client-side in this library.

Once this dummy media object begins playback it automatically obtains media focus (if the concept is implemented on the current platform). Then media key events dispatched toward that object (from any connected remote control hardware and software) will be propagated toward the page that can then be used to control any in-page content in any way the developer wishes.

Compatibility

At the time of writing only iOS supports any level of integration with hardware and software based remote control events from HTMLMediaElement objects. Therefore, this code will currently only work on iOS-based devices.

About

A demonstration of how web apps can access media-centric remote control events to control any other web content

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0