我试图在 wavesurfer.js 中播放 AVI 文件,当我将输入文件作为 AVI 提供时,它说无法读取编码数据,但是使用 wav 文件可以正常工作。所以我决定使用 videojs.wavesurfer 我发现我在控制台中没有看到任何错误消息,并且我无法在我的屏幕上看到任何内容,下面的代码可以请任何人帮助我在 wavesurfer 中读取 avi 文件。或者如果我们无法在 videojswavesurfer 中读取 avi,请告诉我。
import WaveSurfer from '../../../../node_modules/wavesurfer.js'
import TimelinePlug from '../../../../node_modules/wavesurfer.js/dist/plugin/wavesurfer.timeline.min.js';
import videojs from '../../../../node_modules/videojs-wavesurfer/src/js/videojs.wavesurfer.js
var player;
var options = {
controls: true,
autoplay: true,
fluid: false,
loop: false,
width: 600,
height: 300,
plugins: {
wavesurfer: {
src: 'media/example.mp4',
msDisplayMax: 10,
debug: true,
waveColor: '#336699',
progressColor: 'black',
cursorColor: 'black',
hideScrollbar: true
}
}
};
function createPlayer(event) {
player = videojs('myVideo', options, function() {
// print version information at startup
var msg = 'Using video.js '+ videojs.VERSION +
' with videojs-wavesurfer ' +
videojs.getPluginVersion('wavesurfer') +
' and wavesurfer.js ' + WaveSurfer.VERSION;
videojs.log(msg);
});
player.on('waveReady', function(event) {
console.log('waveform: ready!');
});
player.on('playbackFinish', function(event) {
console.log('playback finished.');
});
// error handling
player.on('error', function(error) {
console.warn('ERROR:', error);
});
}';
这是我的html
<div id="myVideo" class="video-js vjs-default-skin"></div>