Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop to many getUserMedia request to the user #36

Open
FreCap opened this issue Jun 1, 2013 · 1 comment
Open

stop to many getUserMedia request to the user #36

FreCap opened this issue Jun 1, 2013 · 1 comment

Comments

@FreCap
Copy link

FreCap commented Jun 1, 2013

I have seen that every time you start a call/session, RTCMulti asks user the approval again.

Inside the function getUserMedia(), can't we save the current local stream, and reuse it every time it's asked?

Example:

        var userMediaInited = false;
        var userMediaStream = null;
        function getUserMedia(options) {
        var n = navigator,
            media;
        resourcesNeeded = (options.constraints || {
                audio: true,
                video: video_constraints
            };

        if(userMediaInited && userMediaStream
                           && userMediaInited.audio >= resourcesNeeded.audio
                           && userMediaInited.video >= resourcesNeeded.video)
            streaming(userMediaStream)
        else{
                 n.getMedia = n.webkitGetUserMedia || n.mozGetUserMedia;
                 n.getMedia(resourcesNeeded, streaming, options.onerror || function (e) {
                       console.error(e);
                 });
        }
        function streaming(stream) {
            video = options.video;
            if (video) {
                video[moz ? 'mozSrcObject' : 'src'] = moz ? stream : window.webkitURL.createObjectURL(stream);
                video.play();
            }
            options.onsuccess(stream);
            userMediaStream = media = stream;
        }

        return media;
    }
@muaz-khan
Copy link
Owner

I planned to include session re-initiation feature in RTCMultiConnection-v1.3 where streams will be stored in an object for re-usability for not only the entire session; but also for the lifetime of the browser instance.

Sessions can be re-initiated many times in the meanwhile. This feature will be included in the final release of v-1.3.

Renegotiation feature prompts getUserMedia on each invocation; so re-usability is important there too.

Possible kinds of streams that can be requested:

  1. audio + video stream
  2. audio-only stream
  3. video-only stream
  4. screen capturing stream

audio+screen or video+screen is not permitted in a single getUserMedia request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants