RE: How to direct audio/vido streams from HTML5 media element to PeerConnection?

I guess you meant to add an attribute to the HTMLMediaElement interface:

interface HTMLMediaElement : HTMLElement<http://www.w3.org/TR/html5/dom.html#htmlelement> {
    ...

    readonly attribute MediaStream<http://www.w3.org/TR/html5/embedded-content-0.html#audiotracklist> mediaStream;
};

Given that this part has reached CR, I'm not sure how easy it is to propose new changes.

On the other hand, we can do something like this if the above is not possible:


interface MediaStreamTrackList {

    readonly attribute unsigned long length<http://www.w3.org/TR/mediacapture-streams/#widl-MediaStreamTrackList-length>;

    MediaStreamTrack<http://www.w3.org/TR/mediacapture-streams/#idl-def-MediaStreamTrack> item<http://www.w3.org/TR/mediacapture-streams/#widl-MediaStreamTrackList-item-MediaStreamTrack-unsigned-long-index> (unsigned long index);

    void             add<http://www.w3.org/TR/mediacapture-streams/#widl-MediaStreamTrackList-add-void-MediaStreamTrack-track> (MediaStreamTrack<http://www.w3.org/TR/mediacapture-streams/#idl-def-MediaStreamTrack> track);

    void             add<http://www.w3.org/TR/mediacapture-streams/#widl-MediaStreamTrackList-add-void-MediaStreamTrack-track> (AudioTrack<http://www.w3.org/TR/mediacapture-streams/#idl-def-MediaStreamTrack> track);

    void             add<http://www.w3.org/TR/mediacapture-streams/#widl-MediaStreamTrackList-add-void-MediaStreamTrack-track> (VideoTrack<http://www.w3.org/TR/mediacapture-streams/#idl-def-MediaStreamTrack> track);

    void             remove<http://www.w3.org/TR/mediacapture-streams/#widl-MediaStreamTrackList-remove-void-MediaStreamTrack-track> (MediaStreamTrack<http://www.w3.org/TR/mediacapture-streams/#idl-def-MediaStreamTrack> track);

    void             remove<http://www.w3.org/TR/mediacapture-streams/#widl-MediaStreamTrackList-remove-void-MediaStreamTrack-track> (AudioTrack<http://www.w3.org/TR/mediacapture-streams/#idl-def-MediaStreamTrack> track);

    void             remove<http://www.w3.org/TR/mediacapture-streams/#widl-MediaStreamTrackList-remove-void-MediaStreamTrack-track> (VideoTrack<http://www.w3.org/TR/mediacapture-streams/#idl-def-MediaStreamTrack> track);

             attribute Function?     onaddtrack<http://www.w3.org/TR/mediacapture-streams/#widl-MediaStreamTrackList-onaddtrack>;

             attribute Function?     onremovetrack<http://www.w3.org/TR/mediacapture-streams/#widl-MediaStreamTrackList-onremovetrack>;

};

Thanks.
Li

From: Travis Leithead [mailto:travis.leithead@microsoft.com]
Sent: Wednesday, January 30, 2013 7:59 PM
To: LiLi (Z); public-media-capture@w3.org
Subject: RE: How to direct audio/vido streams from HTML5 media element to PeerConnection?

Indeed. Another design is an HTMLMediaElement.getMediaStream() API.

From: LiLi (Z) [mailto:Li.NJ.Li@huawei.com]
Sent: Wednesday, January 30, 2013 1:29 PM
To: public-media-capture@w3.org
Subject: How to direct audio/vido streams from HTML5 media element to PeerConnection?

I wonder if it is possible to send the audio/video streams from a HTML5 <audio>/<video> element to a RTCPeerConnection object [1], such that when played, the stream is display locally and sent to the remote peer.

The easiest way to do this is to drop the HTML5 audioTrack and videoTrack objects [2] obtained from the HTML5 element into the constructor of MediaStream [3].
But this doesn't seem possible as the HTML5 audioTrack and videoTrack interfaces are unrelated to the MediaStreamTrack interface accepted by the constructor.

Thanks.
Li

[1] http://www.w3.org/TR/webrtc/#peer-to-peer-connections
[2] http://www.w3.org/TR/html5/embedded-content-0.html#htmlmediaelement
[3] http://www.w3.org/TR/mediacapture-streams/#mediastreamtrack

Received on Thursday, 31 January 2013 19:07:55 UTC