-
Notifications
You must be signed in to change notification settings - Fork 276
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
autocam seems to block .ready() call #34
Comments
hi!
…On Wed, Feb 22, 2017 at 8:43 AM, AdrianR ***@***.***> wrote:
hey,
got a maybe uncommon issue. i want to create some kind of broadcasting
app, where the client dont need or better not has to start the cam. just
connect and watch.
a regular broadcast works fine for me. at the point where i add "autocam:
false" to the phone-config it seems like the .ready()-call is not triggered
and i dont receive any videos
maybe i missed something in the doc? i couldnt figure out whats wrong.
would be great if you could solve me this riddle.
Server:
var broadcaster = PHONE({
number: "BROADCASTER", // If you want more than one broadcaster, use unique ids
publish_key: 'xxx-mypubkey',
subscribe_key: 'xxx-mysubkey'
});
broadcaster.receive(function(new_viewer) {
new_viewer.connected(function(viewer) {
}); // new viewer joined
new_viewer.ended(function(viewer) {
}); // viewer left
//new_viewer.hangup(); // if you want to block the viewer
});
Client:
var viewer = PHONE({
number: "VIEWER-" + new Date,
autocam: false,
publish_key: 'xxx-mypubkey',
subscribe_key: 'xxx-mysubkey'
});
viewer.ready(function() {
var broadcaster = viewer.dial("BROADCASTER");
});
viewer.receive(function(broadcaster) {
broadcaster.connected(function(broadcaster) {
$('#media-stream').prop('src', broadcaster.video.src);
});
broadcaster.ended(function(broadcaster) {});
});
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#34>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AACwnsUCmz0xZQ48hEYRVIDrTBc_kbjeks5rfGWwgaJpZM4MI494>
.
--
Stephen Blum - CTO
https://www.linkedin.com/in/stephenlb/
|
Is your client code correct? |
viewer.ready(function() {
var broadcaster = viewer.dial("BROADCASTER");
}); |
@stephenlb I've got the same issue, I even got to fire de ready event by adding a "oneway" parameter and trigger readycb(), but this doesn't seem to work, inside the viewer.receive event, the broadcaster.connected event never got fired and so I dont get the session video. |
Hi! Reviewing details. |
Yes this makes sense now. Looking into a quick solution. |
Fixed! And a working example may be found here: https://github.com/stephenlb/webrtc-sdk/blob/master/tutorials/autocam-off.html Fix commit: 4773f0a Published new NPM package: |
Thanks for the update @stephenlb, but this doesn't seem to work. The thing is that if the userMedia is not allowed, the stream is null and therefore the ready event is not triggered. The reason the autocam-off.html is a working example is because after 3 seconds the camera is activated, but this is not the use case for a viewer, since he is only there to listen or view the broadcast. This is my code, would I be missing something? Viewer.js const number = ('' + Math.random() * 100000).split('.')[0];
const viewerPhone = PHONE({
number: number,
publish_key: 'pubkey',
subscribe_key: 'subkey',
autocam: false
});
// Since camera is never started, the ready event is never triggered
viewerPhone.ready(() => {
console.log('phone ready');
let session = viewerPhone.dial("BROADCASTERX");
});
viewerPhone.receive(function (broadcaster) {
broadcaster.connected(function (broadcaster) {
console.log('connected');
document.body.appendChild(broadcaster.video);
});
broadcaster.ended(function (broadcaster) { /* broadcast ended */ });
}); Broadcaster.js const broadcasterPhone = PHONE({
number : 'BROADCASTERX'
, autocam : false
, publish_key : 'pubkey'
, subscribe_key : 'subkey'
});
broadcasterPhone.ready(()=>{
let session = broadcasterPhone.dial('BROADCASTERX');
});
// Start camera in 3 seconds after page is loaded.
setTimeout( ()=>{ broadcasterPhone.startcamera() }, 3000 );
broadcasterPhone.receive(function(session){
session.connected( session => {
console.log('Session: connected');
});
session.ended( session => console.log('Session: ENDED') );
});` |
hey,
got a maybe uncommon issue. i want to create some kind of broadcasting app, where the client dont need or better not has to start the cam. just connect and watch.
a regular broadcast works fine for me. at the point where i add "autocam: false" to the phone-config it seems like the .ready()-call is not triggered and i dont receive any videos
maybe i missed something in the doc? i couldnt figure out whats wrong.
would be great if you could solve me this riddle.
Server:
Client:
The text was updated successfully, but these errors were encountered: