简体   繁体   English

jQuery UI Slider作为音量滑块

[英]jQuery UI Slider as Volume Slider

I am in the process of developing a custom volume slider for FlowPlayer based on the standard jQuery UI Slider. 我正在基于标准jQuery UI Slider为FlowPlayer开发自定义音量滑块。 What I would like is some help connecting the slider with the HTML5 video volume controls. 我想要的是将滑块与HTML5视频音量控件连接的一些帮助。

This is the code that initiates the video 这是启动视频的代码

  <video id="mp3" autoplay>
  <source id="mp3source" src="mysource" type="audio/mp3">

I created a jQuery slider to control the volume 我创建了一个jQuery滑块来控制音量

  $(function() {
    $( "#slider" ).slider();
  });

Is there a way I can manipulate the video volume depending on the slider's position ? 有没有一种方法可以根据滑块的位置来控制视频音量?

Thank you in advance 先感谢您

Maybe this will help you / give you impressions what to do: 也许这会帮助您/给您留下深刻的印象:

$( "#slider" ).on( "slide", function( event, ui ) {
    $('#mp3')[0].volume = Math.round(ui.value / 100);
} );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM