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

1 to many Broadcast, prevent viewer from send audio #71

Open
munajaf opened this issue Jul 24, 2019 · 6 comments
Open

1 to many Broadcast, prevent viewer from send audio #71

munajaf opened this issue Jul 24, 2019 · 6 comments

Comments

@munajaf
Copy link

munajaf commented Jul 24, 2019

Hi, ive tried following the docs that you have made.
https://github.com/stephenlb/webrtc-sdk#viewer

everything works fine, i just want to make the viewer cant send any audio and video
just want them to listen to the broadcast.,

tried using the autocam: false on the viewer side.
but the viewer cant hear anything after i did it

@stephenlb
Copy link
Owner

Nice! Try adding media : { audio : true, video : true }, to the BROADCASTER. Something like this:

var broadcaster = PHONE({
    number        : "BROADCASTER",  // If you want more than one broadcaster, use unique ids
    media         : { audio : true, video : true }, // <----------------
    publish_key   : 'pub-c-561a7378-fa06-4c50-a331-5c0056d0163c',
    subscribe_key : 'sub-c-17b7db8a-3915-11e4-9868-02ee2ddab7fe',
    ssl           : true
});

@munajaf
Copy link
Author

munajaf commented Jul 26, 2019

Thank you for your response!
tried like what you have told me to do. when i made the viewer autocam became true,
then i will receive the audio.
down here is my initialize.

BROADCASTER

var broadcaster = PHONE({
                number        : "BROADCASTER",  // If you want more than one broadcaster, use unique ids
                publish_key   : 'pub-c-*',
                subscribe_key : 'sub-c-*',
                media         : { audio : true, video : true },
                ssl           : true
            });

VIEWER

    var viewer = PHONE({
        number        : "VIEWER-"+new Date,
        publish_key   : 'pub-c-*',
        subscribe_key : 'sub-c-*',
        media         : { audio : true, video : true },
        autocam       : false,
        ssl           : true
    });

@stephenlb
Copy link
Owner

I've tried many variations without success.

@stephenlb
Copy link
Owner

Okay I have something that may be a starting point for you. Try these files:

Broadcaster SOURCE
https://github.com/stephenlb/webrtc-sdk/blob/master/tutorials/broadcaster.html

Viewers SOURCE
https://github.com/stephenlb/webrtc-sdk/blob/master/tutorials/viewer.html

@stephenlb
Copy link
Owner

Demo links will help. The autocam:off isn't being used for the demo. However this may get you closer to what you are looking for.

Broadcaster: https://stephenlb.github.io/webrtc-sdk/tutorials/broadcaster.html
Viewer: https://stephenlb.github.io/webrtc-sdk/tutorials/viewer.html

@munajaf
Copy link
Author

munajaf commented Jul 30, 2019

Thank you for your help,
the only way to make the viewer not sending any audio is by using
viewer.camera.toggleAudio();
when the broadcaster is connected so that it will mute the viewer

which is just a workaround,
the viewer will still request for webcam permission,
which is not security wise. some of my user will be asking regarding this permission
maybe i'll just have to explain it to them.

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