Solved

Mute video in iOS

Posted on 2013-01-03
1
1,196 Views
Last Modified: 2013-01-04
Dear Experts,

I have created custom video player using javascript. How to mute video in iOS using javascript? Below is my code:

var myAudio = document.getElementById('myaudio');

if (myAudio.muted==true) {
myAudio.volume = 1;
myAudio.muted = false;
} else {
myAudio.volume = 0;
myAudio.muted = true;
}

Above code working fine in Windows, MAC and Linux. But not working in iOS.

Regards,
John.A
0
Comment
Question by:JohnLourdu
1 Comment
 
LVL 11

Accepted Solution

by:
un1x86 earned 500 total points
ID: 38742915
I think you can not as Apple doesn't follow the standards there. They want to controll it over the hardware mute button.

See http://blog.millermedeiros.com/unsolved-html5-video-issues-on-ios/


No way to control volume using JavaScript

The HTML5 spec says that every media element have a property called volume which is used to get and set the volume of the audio or video playback, this value should be a number from 0.0 to 1.0 (inclusive), but again Apple decided to not follow the standard on the iOS and only allow the volume control using the physical control [3]. Changing the property muted also doesn’t have any effect on the iOS.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now