Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

190
Views
Twilio video JavaScript, calling track.disable() from Safari reloads the page

I have developed a video calling feature using twilio video javascript, everything works fine but when user mutes the video from Safari browser on mac OS, the page reloads automatically showing an error This web page was reloaded because a problem occured. Below is the function called when audio / video is muted/unmuted:

toggleMedia("video");

function toggleMedia(mediaType) {
            try {
                console.log("toggleMedia");
                if (!window.room) return;
                var localMedia = window.room.localParticipant;
                localMedia.tracks.forEach(function (publication) {
                    if (publication.kind === mediaType) {                        
                        if (publication.isTrackEnabled) {
                            publication.track.disable();
                        } else {
                            publication.track.enable();
                        }
                    }
                });
            } catch (e) {
                console.log(e);
            }
        }

I am trying to avoid publish, unpublish track approach. What is wrong with track.disable() on Safari?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Yesterday I also faced this problem! This error is already listed in the list of Common Issues.

The error only appears when using the H264 codec, so you can use the VP8 codec as a temporary solution:

import TwilioVideo from 'twilio-video';

await TwilioVideo.connect(token, {
  name,
  preferredVideoCodecs: [ 'VP8' ]
});

In my case, the code looks like this:

connect(authHelper.getUserVideoChatToken()?.token, { 
        name:'testRoom', 
        audio: true, 
        video: { facingMode: { exact: (isUsingFrontCamera ? 'environment' : 'user') } }, 
        preferredVideoCodecs: ['VP8'] 
}).then(...)
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!