I have a Vue component that has a 'vue-webcam' component inside, my problem is how can I access the "stream" inside of it data and set it to stop using my method out side of that 'vue-webcam' component. Is there anyway of or I have to make a state
<script>
export default{
components:{
'vue-webcam':{
render:function(h){
return h('video',{
...
})
}
props:{
...
},
data:{
return{
video: '',
stream: '', // I need to get this using my btn_stop
hasUserMedia: ''
}
}
}
},
data:()=>({
///...
}),
methods:{
btn_stop(){
let tracks = this.stream.getTracks()[0] // How do I access the "stream" data above on my vue-webcam component
tracks.stop()
}
}
}
</script>
isPlaying: truein your parent component's data, pass it tovue-webcamas a prop. inbtn_stop(), setisPlayingto false, and now yourvue-webcamcan handle the tracks by watchingisPlaying