Commit 44b67a6e authored by Xiaowu Zhang's avatar Xiaowu Zhang

fix consistency between sound and video

parent 385e4fe5
...@@ -228,10 +228,22 @@ ...@@ -228,10 +228,22 @@
} else { } else {
window.location = g.__element.getElementsByClassName("next")[0].href; window.location = g.__element.getElementsByClassName("next")[0].href;
} }
}), loopEventListener(g.video, "ended", false, function() {
if (loop) {
g.audio.load();
g.video.load();
g.audio.play();
g.video.play();
} else {
window.location = g.__element.getElementsByClassName("next")[0].href;
}
}), loopEventListener(command_context, "click", false, function() { }), loopEventListener(command_context, "click", false, function() {
if (g.audio.paused) { if (g.audio.paused) {
g.audio.play(); g.audio.play();
g.video.play(); if (g.type === "video/mp4") {
g.video.currentTime = g.audio.currentTime;
g.video.play();
}
command_context.innerHTML = "stop"; command_context.innerHTML = "stop";
} else { } else {
g.audio.pause(); g.audio.pause();
...@@ -258,6 +270,13 @@ ...@@ -258,6 +270,13 @@
if (g.video.currentTime) { if (g.video.currentTime) {
g.audio.currentTime = g.video.currentTime; g.audio.currentTime = g.video.currentTime;
} }
g.audio.play();
g.video.currentTime = g.audio.currentTime;
//consistency
command_context.innerHTML = "stop";
}), loopEventListener(video, "pause", false, function(event) {
g.audio.pause();
command_context.innerHTML = "play";
}), loopEventListener(bar_context, "mousemove", false, function(event) { }), loopEventListener(bar_context, "mousemove", false, function(event) {
var time = getTime(bar_context, event.clientX); var time = getTime(bar_context, event.clientX);
box_context.style.left = (event.clientX - 20) / 16 + "em"; box_context.style.left = (event.clientX - 20) / 16 + "em";
......
...@@ -311,11 +311,25 @@ ...@@ -311,11 +311,25 @@
.getElementsByClassName("next")[0].href; .getElementsByClassName("next")[0].href;
} }
}), }),
loopEventListener(g.video, "ended", false, function () {
if (loop) {
g.audio.load();
g.video.load();
g.audio.play();
g.video.play();
} else {
window.location = g.__element
.getElementsByClassName("next")[0].href;
}
}),
loopEventListener(command_context, "click", false, function () { loopEventListener(command_context, "click", false, function () {
if (g.audio.paused) { if (g.audio.paused) {
g.audio.play(); g.audio.play();
g.video.play(); if (g.type === "video/mp4") {
g.video.currentTime = g.audio.currentTime;
g.video.play();
}
command_context.innerHTML = "stop"; command_context.innerHTML = "stop";
} else { } else {
g.audio.pause(); g.audio.pause();
...@@ -352,6 +366,14 @@ ...@@ -352,6 +366,14 @@
if (g.video.currentTime) { if (g.video.currentTime) {
g.audio.currentTime = g.video.currentTime; g.audio.currentTime = g.video.currentTime;
} }
g.audio.play();
g.video.currentTime = g.audio.currentTime;//consistency
command_context.innerHTML = "stop";
}),
loopEventListener(video, "pause", false, function (event) {
g.audio.pause();
command_context.innerHTML = "play";
}), }),
loopEventListener(bar_context, "mousemove", loopEventListener(bar_context, "mousemove",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment