The annoying pop-up refuses to vanish even after clicking on the "Stop Capture" button during screen recording

I'm dealing with an issue regarding popups. Whenever I choose "get audio from desktop" and click on "Start Recording", another browser popup appears, prompting me to make another decision (this involves selecting the screen and sharing audio). I've noticed that if I select "Sharing Audio" and click the blue "share" button, the recording begins and a modal appears stating "website is sharing the screen and audio". However, when I stop the recording by clicking the "Stop Capture" button, the modal saying "Website is sharing..." continues to appear. Can someone please assist me or clarify if it's possible to make that modal disappear when I click "Stop Capture". Thank you.

Here is the link to the codepen, the design may be a bit messy but it contains the code for the functionality. Thank you.

https://codepen.io/gian1599/pen/QWpabWK?editors=1011

Images: 1, 2, 3. I have provided detailed information about the workflow, thank you.

new Vue({
  el: "#app",
  vuetify: new Vuetify(),
  data() {
    return {
      valueMicAudioToggle: false,
      valueAudioToggle: false,
      valuestopBtn: true,
      valueCaptureBtn: false,
      valueStart: false,
      stream: "",
      rec: ""
    };
  },
  methods: {
    startBtn() {
      // Code for starting the recording
    },

    stop() {
      // Code for stopping the recording
    }
  }
});
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a1d7d4c4e1938fd9">[email protected]</a>/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="07717262736e617e4735297f">[email protected]</a>/dist/vuetify.js"></script>
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="36404353425f504f7604184e">[email protected]</a>/dist/vuetify.min.css" rel="stylesheet">

// HTML code

Answer №1

When you call the stop function, it stops all the tracks on this.stream. This action includes stopping the video tracks from the desktop stream, but only the audio tracks from the merged audio stream. The original audio tracks from the desktop and microphone remain active, unbeknownst to the browser.

To properly stop the original streams, you can follow this approach:

new Vue({
  // ...
  data () {
    return {
      // ...
      individualAudioStreams: [],
      // ...
    }
  },
  methods: {
    startBtn() {
      // ...

      const mergeAudioStreams = (desktopStream, voiceStream) => {
        // ...
        if (desktopStream && desktopStream.getAudioTracks().length > 0) {
          // ...
          this.individualAudioStreams.push(desktopStream)
        }
        if (voiceStream && voiceStream.getAudioTracks().length > 0) {
          // ...
          this.individualAudioStreams.push(voiceStream)
        }
        // ...
      }

      // ...
    },

    stop() {
      // ...
      this.individualAudioStreams.forEach(s => s.getTracks().forEach(t => t.stop()))
      this.individualAudioStreams = []
      // ...
    }
  },
})

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using Angular and Jade to pass an array from a controller to script tags

I am trying to figure out how to access an array in my controller and display it accurately within the <script> tags in my jade template. For instance: Controller.js $scope.myArray = ["item1","item2"]; Within my index.jade: script. var clien ...

Verify modifications prior to navigating in React or Next.js

I have a simple Next JS application with two pages. -> Home page import Header from "../components/header"; const handleForm = () => { console.log("trigger"); }; export default () => ( <> <Header /> & ...

There seems to be an issue with FastAPI not sending back cookies to the React

Why isn't FastAPI sending the cookie to my React frontend app? Take a look at my code snippet: @router.post("/login") def user_login(response: Response, username :str = Form(), password :str = Form(), db: Session = Depends(get_db)): use ...

After refreshing, Angular route using html5Mode leads to a 'Page Not Found' error page

I have created several Angular routes as illustrated in the code snippet below. app.config(function($routeProvider, $locationProvider, $provide) { $routeProvider .when('/', { templateUrl: 'home.html', controll ...

Utilizing JQuery Template to Invoke JavaScript Functions

If I have the following JSON object structure: ITEMS is an array with one element, and FILTER is another array with 3 items in it. Description: "churches with some restrictions" ITEMS: {...} [0]: {...} FILTER: {...} ...

Tips for preventing redundant code in various functions using Vue.js

I am currently in the process of learning both Javascript and Vue.js, and I am facing a challenge with avoiding duplicated code in two functions using Vue.js. Specifically, I am struggling to figure out how to prevent duplication when resetting data with t ...

Jest testing in a Vue child component is failing due to the presence of lodash

In this specific instance of my Vue app, I have globally loaded lodash as a Vue plugin in the main.js file: import _ from "lodash" export default function install(Vue) { Vue.prototype._ = _ Vue.mixin({ computed: { _: () => ...

Combining the first name, last name, and code in Javascript

I'm attempting to combine the initial letter of both names with the randomly generated code. var firstname = prompt("Please input your first name."); var lastname = prompt ("Please input your last name."); if (amountCorrect >= 4){ ...

Discovering the Week by week commencement and conclusion dates utilizing angularjs

Previously, I was utilizing the angularjs-DatePicker from npm. With this plugin, I could easily select a date from the calendar. However, now I require two fields - FromDate and ToDate - to display the week StartDate and EndDate whenever a date within that ...

Fetching data using JSONRequest sample code

I am new to web development and this is my first attempt at using JSON. On the JSON website (http://www.json.org/JSONRequest.html), they recommend using JSONRequest.get for certain tasks. However, I keep running into an error stating "JSONRequest is not ...

The challenge of handling scopes in Angular-seed

I am currently facing a challenge with creating a pre-routeProvider post. The problem I'm encountering is that $http is coming up as undefined, even though I am passing it to the function as per my understanding. I have made sure to declare angular.js ...

Creating a Custom Alert Box in Javascript with Image Alignment

I have just finished creating a custom alert box using Javascript, complete with text and images. However, I am facing an issue with alignment. The output is not as expected. I am trying to display the correct mark and text on the same line. Can someone ...

Is there a way to trigger a Tab key click event while typing in a text field?

Can you show me how to capture the Tab key event in jQuery? I want to display an alert if a user clicks the Tab key while entering text in an input field. I have tried using the following code but it's not working... var myInput = document.getEleme ...

Struggling to understand why I'm having trouble connecting my AJAX handler within WordPress

Following the instructions here as a guide seems to be leading me astray. After submitting the form below, a POST request to http://thesite/wp-admin/member-update results in a 404 error. I believed that this request should trigger my function member_update ...

Creating Unique Numbers for Every <a> Element

Can someone help me figure out how to create a form that generates a unique set of random numbers from the range (0,9) displayed in a group of button tags? I've written some javascript code but it's not quite working as intended. (function($) ...

Searching for a different method in JavaScript that can add items without duplication, as the prependTo function tends to insert multiple items

Every time my code runs successfully, a success message is generated and displayed using prependTo within the HTML. However, the issue arises when the user performs the successful action twice, resulting in two success messages being shown on the screen. ...

Can you provide an explanation for what the line "const { Nuxt, Builder } = require('nuxt')" is doing in this

Currently, I am working on a Nuxt project where I will be utilizing the Express framework on the server side. Upon setting up the Nuxt project and choosing the express option, I came across a new file named server/index.js which includes a basic template f ...

A guide on showcasing real-time data with Angular's service feature

home.component.ts <h1>{{ (reportsToday$ | async)}}</h1> <div echarts [options]="alertsDaily$ | async"> <div echarts [options]="alertsToday$ | async"> <div [onDisplay]="alertsDaily$ | async"> report.component.ts constructor( ...

Issues encountered with certain Tailwind styles functioning improperly when deployed in a production environment with Next.js

It seems that there are some style issues occurring in the production build hosted on Netlify for a specific component. The problematic component is a wrapper located at ./layout/FormLayout.tsx. Below is the code for this wrapper: const FormLayout: React.F ...

Designing a pop-up window for fetching data using AngularJS

I'm having trouble loading data into a modal window using AngularJS. I want the URL to change when a link is clicked and have the data load into a modal window instead of a new page. I attempted to use the jQuery Facebox plugin, but it doesn't s ...