Skip to content

Commit 6aef69d

Browse files
authored
Merge pull request #798 from adityacp/fix_video_get_duration
Add separate event for the videos other than youtube
2 parents 0cf9c57 + 0a4554d commit 6aef69d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

yaksh/static/yaksh/js/show_toc.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ $(document).ready(function() {
2525
store_video_time(contents_by_time);
2626
var time_arr_length = video_time.length;
2727
var total_duration;
28-
player.on('ready', event => {
28+
player.on('ready loadedmetadata', event => {
2929
total_duration = parseInt(player.duration);
30-
start_tracker((total_duration * 1000) / 4, player);
30+
$("#video_duration").val(get_time_in_hrs(total_duration));
31+
if (total_duration > 0) {
32+
start_tracker((total_duration * 1000) / 4, player);
33+
}
3134
});
3235

3336
player.on('timeupdate', event => {
3437
var current_time = player.currentTime;
35-
$("#video_duration").val(get_time_in_hrs(total_duration));
3638
$("#current_video_time").val(get_time_in_hrs(current_time));
3739
if (time_arr_length > 0 && current_time >= video_time[loc]) {
3840
var content = contents_by_time[loc];

0 commit comments

Comments
 (0)