0
要連接Seek Bar,我使用以下代碼。我能夠尋求韋迪但搜索條是不動的進視頻移動嵌入對象的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 tracker = setInterval(track_audio,100); function track_audio(){//您的跟蹤代碼} – krisph