0
シークバーをフックするには、次のコードを使用しています。 I 見よを追求することができていますが、シークバーが前方映像の動きとして動いていないEmbedオブジェクトのJavascript - timeupdateイベントリスナー
HTML
<embed pluginspage="http://www.videolan.org"
type="application/x-vlc-plugin"
width="640"
height="480"
toolbar="true"
loop="false"
text="Waiting for video"
windowless="true"
bgcolor="#000000"
branding="true"
allowfullscreen="true"
src="./videos/mikethefrog.mp4"
id="video"
name="vlc" />
<input type="range" id="seek-bar" value="0" onChange='seekBar();'>
JS
window.onload = function() {
var vlc = getVLC("vlc");
// Update the seek bar as the video plays
var video = document.getElementById("video");
var seekBar = document.getElementById("seek-bar");
var mediaLen = vlc.input.length;
video.addEventListener("timeupdate", function() {
// Calculate the slider value
var value = (100/mediaLen) * vlc.input.time;
// Update the slider value
seekBar.value = value;
});
function seekBar(){
var vlc = getVLC("vlc");
var seekBar = document.getElementById("seek-bar");
var mediaLen = vlc.input.length;
// Event listener for the seek bar
seekBar.addEventListener("change", function() {
// Calculate the new time
var time = mediaLen * (seekBar.value/100);
// Update the video time
vlc.input.time = time;
//vlc.playlist.play();
console.log(vlc.input.time);
});
// Pause the video when the seek handle is being dragged
seekBar.addEventListener("mousedown", function() {
console.log('pause');
vlc.playlist.pause();
});
// Play the video when the seek handle is dropped
seekBar.addEventListener("mouseup", function() {
console.log('play');
vlc.playlist.play();
});
}
}
例外
Error: Error calling method on NPObject! video.addEventListener("timeupdate", function() {
'vlc.input.time'は何かを生成しますか?もしそうなら、あなたはちょうど間隔を使うことができるでしょう。 – krisph
'vlc.input.time'は私にミリ秒で与えられた絶対的な位置を与えます。インターバルはどのように使用しますか? – Slimshadddyyy
varトラッカー= setInterval(track_audio、100); function track_audio(){//あなたのトラッキングコード} – krisph