Skip to content

Commit

Permalink
Merge pull request #798 from adityacp/fix_video_get_duration
Browse files Browse the repository at this point in the history
Add separate event for the videos other than youtube
  • Loading branch information
adityacp authored Nov 12, 2020
2 parents 0cf9c57 + 0a4554d commit 6aef69d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions yaksh/static/yaksh/js/show_toc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ $(document).ready(function() {
store_video_time(contents_by_time);
var time_arr_length = video_time.length;
var total_duration;
player.on('ready', event => {
player.on('ready loadedmetadata', event => {
total_duration = parseInt(player.duration);
start_tracker((total_duration * 1000) / 4, player);
$("#video_duration").val(get_time_in_hrs(total_duration));
if (total_duration > 0) {
start_tracker((total_duration * 1000) / 4, player);
}
});

player.on('timeupdate', event => {
var current_time = player.currentTime;
$("#video_duration").val(get_time_in_hrs(total_duration));
$("#current_video_time").val(get_time_in_hrs(current_time));
if (time_arr_length > 0 && current_time >= video_time[loc]) {
var content = contents_by_time[loc];
Expand Down

0 comments on commit 6aef69d

Please sign in to comment.