javascript - Twilio End Video Capture from Local Webcam -


i have functioning twilio video-chat application working expect, other cannot end video-stream when user hits close button. i've looked through javascript quick-start , have tried following implementations:
(attempting use webrtc's method, complains twilio.media.mediastream undefined);

function endvidconf(room){     console.log('attempting end vid conf');     room.localparticipant.tracks.foreach(function(track) {         var attachedelements = track.detach();         attachedelements.foreach(function(element){             element.remove();         });     });     twilio.media.mediastream.getaudiotracks()[0].stop();     twilio.media.mediastream.getvideotracks()[0].stop();     room.disconnect(); }; 

(using track.stop() -- webcam still on):

function endvidconf(room){     console.log('attempting end vid conf');     room.localparticipant.tracks.foreach(function(track) {         var attachedelements = track.detach();         attachedelements.foreach(function(element){             element.remove();         });         track.stop();     });     room.disconnect(); }; 

is there simple i'm missing or more details implementation needed?

i had make sure code changes within twilio.connect.createlocaltracks().then(function(){...});
attempting similar fixes elsewhere did not work. had assign local tracks trackarray, call stop() on entries on array.
twilio.video.createlocaltracks().then(function(localtracks) { ... trackarray = localtracks; trackarray[0].stop(); trackarray[1].stop(); ... })


issue must have been hoisting somehow.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -