function handleLocalStream(streams, resolution) {
    var audioStream, videoStream, desktopStream, res = [];
    // If this is FF, the stream parameter is *not* a MediaStream object, it's
    // an object with two properties: audioStream, videoStream.
    if (window.webkitMediaStream) {
        var audioVideo = streams.audioVideo;
        if (audioVideo) {
            var audioTracks = audioVideo.getAudioTracks();
            if (audioTracks.length) {
                audioStream = new webkitMediaStream();
                for (var i = 0; i < audioTracks.length; i++) {
                    audioStream.addTrack(audioTracks[i]);
                }
            }

            var videoTracks = audioVideo.getVideoTracks();
            if (videoTracks.length) {
                videoStream = new webkitMediaStream();
                for (var j = 0; j < videoTracks.length; j++) {
                    videoStream.addTrack(videoTracks[j]);
                }
            }
        }

        // FIXME Checking streams here is unnecessary because there's
        // streams.audioVideo above.
        if (streams)
            desktopStream = streams.desktopStream;

    }
    else if (RTCBrowserType.isFirefox() || RTCBrowserType.isTemasysPluginUsed()) {   // Firefox and Temasys plugin
        if (streams) {
            audioStream = streams.audio;
            videoStream = streams.video;
            desktopStream = streams.desktop;
        }
    }

    if (desktopStream)
        res.push({
            stream: desktopStream,
            track: desktopStream.getVideoTracks()[0],
            mediaType: MediaType.VIDEO,
            videoType: VideoType.DESKTOP
        });

    if(audioStream)
        res.push({
            stream: audioStream,
            track: audioStream.getAudioTracks()[0],
            mediaType: MediaType.AUDIO,
            videoType: null
        });

    if(videoStream)
        res.push({
            stream: videoStream,
            track: videoStream.getVideoTracks()[0],
            mediaType: MediaType.VIDEO,
            videoType: VideoType.CAMERA,
            resolution: resolution
        });

    return res;
}
/**
 * Handles the newly created Media Streams.
 * @param streams the new Media Streams
 * @param resolution the resolution of the video streams
 * @returns {*[]} object that describes the new streams
 */
Handles the newly created Media Streams.
@param streams the new Media Streams
@param resolution the resolution of the video streams
@returns {*[]} object that describes the new streams
Handles the newly created Media Streams . @param streams the new Media Streams @param resolution the resolution of the video streams @returns { * [] } object that describes the new streams
function handleLocalStream(streams, resolution) {
    var audioStream, videoStream, desktopStream, res = [];
    if (window.webkitMediaStream) {
        var audioVideo = streams.audioVideo;
        if (audioVideo) {
            var audioTracks = audioVideo.getAudioTracks();
            if (audioTracks.length) {
                audioStream = new webkitMediaStream();
                for (var i = 0; i < audioTracks.length; i++) {
                    audioStream.addTrack(audioTracks[i]);
                }
            }
            var videoTracks = audioVideo.getVideoTracks();
            if (videoTracks.length) {
                videoStream = new webkitMediaStream();
                for (var j = 0; j < videoTracks.length; j++) {
                    videoStream.addTrack(videoTracks[j]);
                }
            }
        }
        if (streams)
            desktopStream = streams.desktopStream;
    }
    else if (RTCBrowserType.isFirefox() || RTCBrowserType.isTemasysPluginUsed()) {   
        if (streams) {
            audioStream = streams.audio;
            videoStream = streams.video;
            desktopStream = streams.desktop;
        }
    }
    if (desktopStream)
        res.push({
            stream: desktopStream,
            track: desktopStream.getVideoTracks()[0],
            mediaType: MediaType.VIDEO,
            videoType: VideoType.DESKTOP
        });
    if(audioStream)
        res.push({
            stream: audioStream,
            track: audioStream.getAudioTracks()[0],
            mediaType: MediaType.AUDIO,
            videoType: null
        });
    if(videoStream)
        res.push({
            stream: videoStream,
            track: videoStream.getVideoTracks()[0],
            mediaType: MediaType.VIDEO,
            videoType: VideoType.CAMERA,
            resolution: resolution
        });
    return res;
}
function handleLocalStream ( streams , resolution ) { var audioStream , videoStream , desktopStream , res = [ ] ; if ( window . webkitMediaStream ) { var audioVideo = streams . audioVideo ; if ( audioVideo ) { var audioTracks = audioVideo . getAudioTracks ( ) ; if ( audioTracks . length ) { audioStream = new webkitMediaStream ( ) ; for ( var i = 0 ; i < audioTracks . length ; i ++ ) { audioStream . addTrack ( audioTracks [ i ] ) ; } } var videoTracks = audioVideo . getVideoTracks ( ) ; if ( videoTracks . length ) { videoStream = new webkitMediaStream ( ) ; for ( var j = 0 ; j < videoTracks . length ; j ++ ) { videoStream . addTrack ( videoTracks [ j ] ) ; } } } if ( streams ) desktopStream = streams . desktopStream ; } else if ( RTCBrowserType . isFirefox ( ) || RTCBrowserType . isTemasysPluginUsed ( ) ) { if ( streams ) { audioStream = streams . audio ; videoStream = streams . video ; desktopStream = streams . desktop ; } } if ( desktopStream ) res . push ( { stream : desktopStream , track : desktopStream . getVideoTracks ( ) [ 0 ] , mediaType : MediaType . VIDEO , videoType : VideoType . DESKTOP } ) ; if ( audioStream ) res . push ( { stream : audioStream , track : audioStream . getAudioTracks ( ) [ 0 ] , mediaType : MediaType . AUDIO , videoType : null } ) ; if ( videoStream ) res . push ( { stream : videoStream , track : videoStream . getVideoTracks ( ) [ 0 ] , mediaType : MediaType . VIDEO , videoType : VideoType . CAMERA , resolution : resolution } ) ; return res ; }
Handles the newly created Media Streams.
Handles the newly created Media Streams .
// If this is FF, the stream parameter is *not* a MediaStream object, it's // an object with two properties: audioStream, videoStream. // FIXME Checking streams here is unnecessary because there's // streams.audioVideo above. // Firefox and Temasys plugin