Commit cbd64756 authored by Xiaowu Zhang's avatar Xiaowu Zhang

change mp4 support for webm

parent 1641ccf2
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
gadget.gain.connect(audioCtx.destination); gadget.gain.connect(audioCtx.destination);
gadget.audio.src = url; gadget.audio.src = url;
gadget.audio.load(); gadget.audio.load();
if (gadget.type === "video/mp4") { if (gadget.type === "video/webm") {
gadget.video.src = url; gadget.video.src = url;
gadget.video.load(); gadget.video.load();
} }
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
time_context.innerHTML = timeFormat(that.audio.duration - that.audio.currentTime); time_context.innerHTML = timeFormat(that.audio.duration - that.audio.currentTime);
that.video.volume = 0; that.video.volume = 0;
}; };
if (that.type !== "video/mp4") { if (that.type !== "video/webm") {
canvas.style.display = ""; canvas.style.display = "";
that.video.style.display = "none"; that.video.style.display = "none";
return promiseRequestAnimation(drawFrame); return promiseRequestAnimation(drawFrame);
...@@ -221,7 +221,7 @@ ...@@ -221,7 +221,7 @@
if (loop) { if (loop) {
g.audio.load(); g.audio.load();
g.audio.play(); g.audio.play();
if (g.type === "video/mp4") { if (g.type === "video/webm") {
g.video.load(); g.video.load();
g.video.play(); g.video.play();
} }
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
}), 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();
if (g.type === "video/mp4") { if (g.type === "video/webm") {
g.video.currentTime = g.audio.currentTime; g.video.currentTime = g.audio.currentTime;
g.video.play(); g.video.play();
} }
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
g.audio.currentTime = getTime(bar_context, event.clientX); g.audio.currentTime = getTime(bar_context, event.clientX);
bar_context.value = g.audio.currentTime; bar_context.value = g.audio.currentTime;
g.audio.play(); g.audio.play();
if (g.type === "video/mp4") { if (g.type === "video/webm") {
g.video.currentTime = g.audio.currentTime; g.video.currentTime = g.audio.currentTime;
g.video.play(); g.video.play();
} }
......
...@@ -9979,11 +9979,11 @@ decodeURI, encodeURI*/ ...@@ -9979,11 +9979,11 @@ decodeURI, encodeURI*/
result = result.substring(index + 7); result = result.substring(index + 7);
index = result.indexOf("\">"); index = result.indexOf("\">");
url = result.substring(0, index); url = result.substring(0, index);
if (url.indexOf(".mp3") === -1 && url.indexOf(".mp4") === -1) { if (url.indexOf(".mp3") === -1 && url.indexOf(".webm") === -1) {
result = result.substring(index + 2); result = result.substring(index + 2);
} else { } else {
if (url.indexOf(".mp4") !== -1) { if (url.indexOf(".webm") !== -1) {
type = "video/mp4"; type = "video/webm";
} else { } else {
type = "audio/mp3" type = "audio/mp3"
} }
......
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
gadget.gain.connect(audioCtx.destination); gadget.gain.connect(audioCtx.destination);
gadget.audio.src = url; gadget.audio.src = url;
gadget.audio.load(); gadget.audio.load();
if (gadget.type === "video/mp4") { if (gadget.type === "video/webm") {
gadget.video.src = url; gadget.video.src = url;
gadget.video.load(); gadget.video.load();
} }
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
that.audio.currentTime); that.audio.currentTime);
that.video.volume = 0; that.video.volume = 0;
}; };
if (that.type !== "video/mp4") { if (that.type !== "video/webm") {
canvas.style.display = ""; canvas.style.display = "";
that.video.style.display = "none"; that.video.style.display = "none";
return promiseRequestAnimation(drawFrame); return promiseRequestAnimation(drawFrame);
...@@ -302,7 +302,7 @@ ...@@ -302,7 +302,7 @@
if (loop) { if (loop) {
g.audio.load(); g.audio.load();
g.audio.play(); g.audio.play();
if (g.type === "video/mp4") { if (g.type === "video/webm") {
g.video.load(); g.video.load();
g.video.play(); g.video.play();
} }
...@@ -326,7 +326,7 @@ ...@@ -326,7 +326,7 @@
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();
if (g.type === "video/mp4") { if (g.type === "video/webm") {
g.video.currentTime = g.audio.currentTime; g.video.currentTime = g.audio.currentTime;
g.video.play(); g.video.play();
} }
...@@ -342,7 +342,7 @@ ...@@ -342,7 +342,7 @@
g.audio.currentTime = getTime(bar_context, event.clientX); g.audio.currentTime = getTime(bar_context, event.clientX);
bar_context.value = g.audio.currentTime; bar_context.value = g.audio.currentTime;
g.audio.play(); g.audio.play();
if (g.type === "video/mp4") { if (g.type === "video/webm") {
g.video.currentTime = g.audio.currentTime; g.video.currentTime = g.audio.currentTime;
g.video.play(); g.video.play();
} }
......
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