HTML5 Video Volume

后端 未结 4 1482
慢半拍i
慢半拍i 2020-12-17 09:31

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

相关标签:
4条回答
  • 2020-12-17 09:50

    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.

    0 讨论(0)
  • 2020-12-17 09:50

    As @dobrin said, the volume property is read only on IOS for the video.

    However, you could use the muted property, this allow you to mute or unmute video, most of the time, this will respond to the problem.

    So, you can't set a specific volume between 0 and 1 but you can set the volume either to 0 or 1, then Apple assume that you will use the physical buttons for setting the volume.

    https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/muted

    0 讨论(0)
  • 2020-12-17 09:52
    var muted = false;
    $j('.player-mute').click(function(){
    if(muted) {
        videoPlayer.volume(1);
        muted = false;
    } else {
        videoPlayer.volume(0);
        muted = true;
    }
    });
    

    use like function

    0 讨论(0)
  • 2020-12-17 09:58

    If you read the iPad html5 video documentation it says that only the user of the device can start video, and change volume.

    0 讨论(0)
提交回复
热议问题