Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
523 views
in Technique[技术] by (71.8m points)

ios - HTML5 Video Volume

I'm currently working on an HTML5 video player, I have it working fully everywhere, except on the iPad. Basically, I can control everything, except the sound, I have a mute button, it works fine on Google Chrome, Firefox 3.6 and Safari on Mac OS, but on the iPad no matter what value I put in video.volume, there is no change happening.

Did anybody get it working properly?

Here's my HTML code:

<video src="video_url" width="608" height="476" autobuffer="autobuffer" id="html5-player" preload>
   Your browser doesn't support HTML5.
</video

And here's the Javascript:

var muted = false;
$j('.player-mute').click(function(){
    if(muted) {
        videoPlayer.volume = 1;
        muted = false;
    } else {
        videoPlayer.volume = 0;
        muted = true;
    }
});
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The volume property on the iOS devices is read-only according to Apple's documentation:

On iOS devices, the audio level is always under the user’s physical control. The volume property is not settable in JavaScript. Reading the volume property always returns 1.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...