简体   繁体   中英

how to read AVI file using wavesurfer.js in Angular 7

im trying to play AVI file in wavesurfer.js it says cant read encoded data when i provide the input file as AVI but, with wav file it works fine. so i decided to use videojs.wavesurfer im struck im not seeing any error message in console and im unable to see anything on my screen with below code can anyone please help me to read avi file in wavesurfer. or please let me know if we cannot read avi in videojswavesurfer .

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);
       });
   }';

here is my html

 <div id="myVideo" class="video-js vjs-default-skin"></div>

https://wavesurfer-js.org/examples/

Here they given all exmaples

It's working for me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM