RTCMultiConnection Docs

RTCMultiConnection API Reference / "onstreamended" event

"onstreamended" event is fired for all local/remote media streams. Each media stream is given a unique stream-id and an EVENT object is passed over onstreamended allows you check not only type of stream, also all possible things e.g. is it a screen stream or audio/video; stream sender's userid and extra-data; and much more!
connection.onstreamended = function(e) {
    // e.mediaElement (audio or video element)
    // e.stream     native MediaStream object
    // e.streamid   unique identifier of the stream; synced among all users!
    // e.session    {audio: true, video: true, screen: true}
    // e.blobURL    blob-URI
    // e.type       "local" or "remote"
    // e.extra
    // e.userid      the person who shared stream with you!
    
    // easiest way to remove relevant element!
    e.mediaElement.parentNode.removeChild(e.mediaElement);
    
    // e.isVideo ---- if it is a  Video stream
    // e.isAudio ---- if it is an Audio stream
    // e.isScreen --- if it is screen-sharing stream
};

Why "onstreamended" isn't fired for me?

  1. Signaling gateway is weekly implemented.
  2. Server response time is too slow.
  3. "window.onbeforeunload" event isn't fired.
  4. WebSocket connection was closed before firing "window.onbeforeunload" event.
  5. WebSocket connection failed to send a message from "window.onbeforeunload" event because browser was smart enough to close the tab/window too fast!

How "onstreamended" is useful?

  1. You'll have direct link to target audio/video elements; so you don't need to manually set "ids" for such HTML elements; also you don't need to manually seek/query for relevant audio/video elements!
  2. Same event is fired for all following:
    1. http://www.RTCMultiConnection.org/docs/onstream/
    2. http://www.RTCMultiConnection.org/docs/onstreamended/
    3. http://www.RTCMultiConnection.org/docs/onmute/
    4. http://www.RTCMultiConnection.org/docs/onunmute/
    5. http://www.RTCMultiConnection.org/docs/onhold/
    6. http://www.RTCMultiConnection.org/docs/onunhold/
    7. http://www.RTCMultiConnection.org/docs/onspeaking/
    8. http://www.RTCMultiConnection.org/docs/onsilence/

Want to ask a Question?

You can include your email for private conversation!

Latest Updates