1

Recording has been started using navigator.mediaDevices.getUserMedia(). Following is the code: (Vue Js)

   <a href="javascript:void(null)" @click="stopRecording">Stop</a>
   <script>
    methods:{
     stopRecording() {
       if (window.mediaStream) {
         window.mediaStream.getTracks().forEach(function(track) {
         track.stop();
       });
      }
     }
    </script>

Also tried Stop/Close webcam which is opened by navigator.getUserMedia. Immediately after calling track.stop(), the 'readyState' of audio is set to ended. But the recording icon is not removed from the tab.

Vidhya
  • 507
  • 6
  • 13
  • The code shown is correct, and should be sufficient. Which browser? - I suspect you have a bug in code not shown. – jib May 11 '19 at 03:27
  • @jib I'm currently testing on chrome. Modified the question to whole code. I'm trying it on Vue Js. Hope this code works for all frameworks. – Vidhya May 14 '19 at 06:39
  • @jib There was a problem with my code. I was calling 'navigator.mediaDevices.getUserMedia' function 2 times and that caused the issue. Thank you for your response. :) – Vidhya May 17 '19 at 04:45
  • Does this answer your question? [Remove red icon after recording has stopped](https://stackoverflow.com/questions/26670677/remove-red-icon-after-recording-has-stopped) – Dürrani Aug 20 '21 at 10:29

0 Answers0