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

Peer.Call without stream #158

Closed
choudeshell opened this issue Feb 18, 2014 · 18 comments
Closed

Peer.Call without stream #158

choudeshell opened this issue Feb 18, 2014 · 18 comments
Assignees
Milestone

Comments

@choudeshell
Copy link

It seems that it impossible to utilize Peer.Call without passing in a user media stream. Peer.Call should be able to call any peer even if the caller decides to not give the browser access to their webcam/mic.

@michelle
Copy link
Member

michelle commented Mar 3, 2014

Good point; we'll look into adding this.

@michelle michelle self-assigned this Mar 3, 2014
@ericz ericz added this to the 0.4 milestone Mar 10, 2014
@dervalp
Copy link

dervalp commented May 23, 2014

+1

Calling without sending a stream seems a reasonable feature to me. Any update on that ? :)

@michelle
Copy link
Member

Sorry, haven't had the time recently :(. Happy to review PRs though.

Michelle

On Fri, May 23, 2014 at 2:01 PM, Pierre notifications@github.com wrote:

+1

Calling without sending a stream seems a reasonable feature to me. Any
update on that ? :)


Reply to this email directly or view it on GitHubhttps://github.com//issues/158#issuecomment-44059854
.

@grabbou
Copy link

grabbou commented Jun 24, 2014

I solved that by passing new webkitMediaStream() as a media stream to method call(). As my app is being used only in Chrome, it's not an issue for me.

Hope it helps :)

@thomasverleye
Copy link

@grabbou can you paste some example code?

@jhogoforbroke
Copy link

+1
@grabbou that`s so simple solution and works for me tks, do you know how do it in firefox? i try MediaStream but not works 😅

@doppio
Copy link

doppio commented Jan 29, 2016

@michelle, I don't suppose you have any thoughts on how this could be implemented? I know very little about WebRTC, but it would be enormously helpful to me to be able to make calls as a user without a stream.

@Rastopyr
Copy link

+1

@ndac-todoroki
Copy link

+1 too

@mahmed0715
Copy link

+1

@vikramarjun
Copy link

@jhogoforbroke Can you post some sample of how you achieved this. I am attaching the client and server code. The server code is just expected to broadcast the video and all clients can just view the video without having to share any media. When I use new webkitMediaStream() the server is not streaming any data.
peer_server.txt

peer_client.txt

@demogoran
Copy link

Not sure, if it's still actual, but got able to bypass it using this trick:

const audioCtx = new AudioContext();
const dest = audioCtx.createMediaStreamDestination();
var call = peer.call('testid', dest.stream);

@yunusberateke
Copy link

Not sure, if it's still actual, but got able to bypass it using this trick:

const audioCtx = new AudioContext();
const dest = audioCtx.createMediaStreamDestination();
var call = peer.call('testid', dest.stream);

it's not working

can anyone solve this problem?

@wilywork
Copy link

@yunusberateke it's work

const createMediaStreamFake = () => {
      return new MediaStream([createEmptyAudioTrack(), createEmptyVideoTrack({ width:640, height:480 })]);
}

const createEmptyAudioTrack = () => {
    const ctx = new AudioContext();
    const oscillator = ctx.createOscillator();
    const dst = oscillator.connect(ctx.createMediaStreamDestination());
    oscillator.start();
    const track = dst.stream.getAudioTracks()[0];
    return Object.assign(track, { enabled: false });
}

const createEmptyVideoTrack = ({ width, height }) => {
    const canvas = Object.assign(document.createElement('canvas'), { width, height });
    canvas.getContext('2d').fillRect(0, 0, width, height);
  
    const stream = canvas.captureStream();
    const track = stream.getVideoTracks()[0];
  
    return Object.assign(track, { enabled: false });
};

@mind0bender
Copy link

@wilywork
Thanks for that
It does work but only for answering the call
It would be great if it worked for calling too.

In my case I want the student to call the teacher but not share his media.

@aschenkuttel
Copy link

any updates?

@KoushikwebDev
Copy link

issue not solved yet, kindly look into this issue.

@BadTripp
Copy link

BadTripp commented Mar 14, 2024

This worked for me, in angular and capacitor project on android
`
const createMediaStreamFake = (): MediaStream => {
return new MediaStream([createEmptyAudioTrack(), createEmptyVideoTrack({ width: 640, height: 480 })]);
}

const createEmptyAudioTrack = (): MediaStreamTrack => {
const ctx = new AudioContext();
const oscillator = ctx.createOscillator();
const destination = ctx.createMediaStreamDestination();
oscillator.connect(destination);
oscillator.start();
const track = destination.stream.getAudioTracks()[0];
return Object.assign(track, { enabled: false }) as MediaStreamTrack;
}

const createEmptyVideoTrack = ({ width, height }): MediaStreamTrack => {
const canvas = Object.assign(document.createElement('canvas'), { width, height });
canvas.getContext('2d').fillRect(0, 0, width, height);
const stream = canvas.captureStream();
const track = stream.getVideoTracks()[0];
return Object.assign(track, { enabled: false }) as MediaStreamTrack;
};`

const mediaOptions = { metadata: { var: '123' }, constraints: { mandatory: { OfferToReceiveAudio: true, OfferToReceiveVideo: true } } }; const call = this.peer.call('clientB', this.localStream, { ...mediaOptions });

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