1.4.0 Alpha #002

This commit is contained in:
2017-08-28 23:43:54 +02:00
parent d7958e1594
commit 27053a4880
11 changed files with 161 additions and 118 deletions

46
src/app/js/player.js Normal file
View File

@@ -0,0 +1,46 @@
var video;
$(function(){
video = document.getElementById('video');
// btn
var st_play = '<i class="fa fa-play-circle-o" aria-hidden="true"></i>';
var st_pause = '<i class="fa fa-pause-circle-o" aria-hidden="true"></i>';
video.ontimeupdate = function(){
var percentage = ( video.currentTime / video.duration ) * 100;
$("#time span").css("width", percentage+"%");
};
$("#time").on("click", function(e){
var offset = $(this).offset();
var left = (e.pageX - offset.left);
var totalWidth = $("#time").width();
var percentage = ( left / totalWidth );
var vidTime = video.duration * percentage;
video.currentTime = vidTime;
})
$("#volume span").css('width',(100*video.volume)+'%')
$("#volume").on("click", function(e){
var offset = $(this).offset();
var left = (e.pageX - offset.left);
var totalWidth = $("#volume").width();
var percentage = ( left / totalWidth );
var volume = 1 * percentage;
video.volume = volume;
$("#volume span").css('width',(100*percentage)+'%')
console.log(volume)
})
$('#play').click(function(){
if(video.paused){
video.play();
$('#play').html(st_pause)
}else{
video.pause();
$('#play').html(st_play)
}
})
})