Re: [presentation-api] Presenting the content of an <audio> or <video> element

Thanks Anssi for tagging it with F2F. I'd like to see this discussed 
after the higher priority Presentation API issues. I drafted a change 
proposal to the HTMLMediaElement and HTMLSourceElement tags that goes 
like this:

// A twin of AvailableChange event for HTMLMediaElement:
[Constructor(DOMString type,
    optional RemotePlaybackAvailabilityChangeEventInit eventInitDict)]
interface RemotePlaybackAvailabilityChangeEvent : Event {
  readonly attribute boolean available;
};

dictionary RemotePlaybackAvailabilityChangeEventInit : EventInit {
  boolean available;
};

// Event that notifies the page when the media element is being played
 remotely,
// contains the human readable screen name for better UI integration.
[Constructor(DOMString type,
    optional RemoteStateChangeEventInit eventInitDict)]
interface RemoteStateChangeEvent : Event {
  readonly attribute PresentationSessionState state;
  readonly attribute DOMString screenName;
};

dictionary RemoteStateChangeEventInit : EventInit {
  PresentationSessionState state;
  DOMString screenName;
};

// Two extra methods and two extra events for the HTMLMediaElement
partial interface HTMLMediaElement : HTMLMediaElement {
  // allow the page to be notified if it should show remote playback 
UI
  // similar to the presentation API, we don't need a matching boolean
  attribute EventHandler onremoteplaybackavailabilitychange;

  // notifies the page when the media starts playing remotely or
  // disconnects; also called if the browser initiates the remote 
playback
  attribute EventHandler onremotestatechange;

  // starts the remote playback from the current position; UA shows 
the device
  // picker
  void startRemotePlayback();

  // allows the page to stop the playback, local playback may continue
 from the
  // current position
  void stopRemotePlayback();
}

partial interface HTMLSourceElement {
  // if true (by default) the src attribute can be used for remote 
playback; 
  // else, playing this source remotely is disabled.
  attribute boolean allowRemotePlayback=true;
}

This could be polyfilled using the Presentation API provided some 
defautl media player presentation URL.
I'd like the media to be playable remotely by default but allow the 
page to mark <source> elements as local only (i.e. for licensing, 
access control or quality issues). HTMLMediaElement commands like 
play()/pause() coud be reused to work with the remote playback in the 
case of playing the media on the second screen so there's no need to 
invent any messaging protocol.

Some rules will have to be specified regarding CORS, EME, MSE, etc.

Let me know what you think.

-- 
GitHub Notif of comment by avayvod
See 
https://github.com/w3c/presentation-api/issues/13#issuecomment-77869735

Received on Monday, 9 March 2015 15:02:18 UTC