HTML5 audio clicking the progress bar to move to a different time

前端 未结 4 1350
暗喜
暗喜 2021-01-18 03:43

    
    
               


        
4条回答
  •  忘掉有多难
    2021-01-18 04:16

    Hope this can save someone some time. If you're trying to set this up in an Angular app, you'll notice this is your controller context. So you'll need to use e.srcElement.clientWidth for this to work.

    vm.setPosition = function(e){
    
      var percent = ((e.offsetX / e.srcElement.clientWidth));
    
      vm.songObject.setProgress(percent);
    }
    

提交回复
热议问题