summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPalaparthy Adityachandra2020-11-12 21:49:03 +0530
committerGitHub2020-11-12 21:49:03 +0530
commit6aef69d6e5a3eb3dde2d39e0bb9e1dd5b05a8b3c (patch)
tree1fdb50c8c16d85d8b61a7c793aadfaa93235c22e
parent0cf9c577125b400610bd51fff32d4a9de0dca946 (diff)
parent0a4554d28b3901f40fe88d9df1ea899e8c18f3fe (diff)
downloadonline_test-6aef69d6e5a3eb3dde2d39e0bb9e1dd5b05a8b3c.tar.gz
online_test-6aef69d6e5a3eb3dde2d39e0bb9e1dd5b05a8b3c.tar.bz2
online_test-6aef69d6e5a3eb3dde2d39e0bb9e1dd5b05a8b3c.zip
Merge pull request #798 from adityacp/fix_video_get_durationv0.29.1
Add separate event for the videos other than youtube
-rw-r--r--yaksh/static/yaksh/js/show_toc.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/yaksh/static/yaksh/js/show_toc.js b/yaksh/static/yaksh/js/show_toc.js
index be08e78..914ab1c 100644
--- a/yaksh/static/yaksh/js/show_toc.js
+++ b/yaksh/static/yaksh/js/show_toc.js
@@ -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];