RTCMultiConnection Docs

RTCMultiConnection API Reference / "shareMediaFile" method

  1. "shareMediaFile" method allows you share pre-recorded WebM media files:
  2. // select WebM file to share as pre-recorded media!
    document.querySelector('input[type=file]').onchange = function() {
        connection.shareMediaFile( this.files[0] );
    };
    
    // receive WebM files
    connection.onMediaFile = function(e) {
        // e.mediaElement (it is video-element)
        // e.userid
        // e.extra
        
        yourExistingVideoElement.src = e.mediaElement.src;
        
        // or
        document.body.appendChild(e.mediaElement);
    };
    
    // "connection.preRecordedMedias" object allows you get list of pre-recorded 
    // media files shared
    for(var media in connection.preRecordedMedias) {
        console.log(media, connection.preRecordedMedias[media] );
        
        // connection.preRecordedMedias[media].video
        // connection.preRecordedMedias[media].streamer
        // connection.preRecordedMedias[media].onData
    }
    


Want to ask a Question?

You can include your email for private conversation!