Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video demo not showing video with waveform #8

Closed
chinshr opened this issue Aug 26, 2015 · 5 comments
Closed

Video demo not showing video with waveform #8

chinshr opened this issue Aug 26, 2015 · 5 comments

Comments

@chinshr
Copy link

chinshr commented Aug 26, 2015

In the video example I would expect to see the video playing along with the waveform, instead I only see the waveform

@thijstriemstra
Copy link
Member

If you change the video example by adding a src attribute to the video element and disable autoplay like this:

<video id="myVideo" class="video-js vjs-default-skin" muted src="media/example.mp4"></video>

<script>
var player = videojs("myVideo",
{
    controls: true,
    autoplay: false,
    loop: false,
    width: 600,
    height: 300,
    plugins: {
        wavesurfer: {
            src: "media/example.mp4",
            msDisplayMax: 10,
            waveColor: "grey",
            progressColor: "black",
            cursorColor: "black",
            hideScrollbar: true
        }
    }
});

Then you'll see the video underneath the waveform and both audio and video start playing when you press play.

Unfortunately there are a couple of issues with this:

  • the video seems to start a few 100 ms later than the audio. This screws up the player when you press play after it finished for the first time.
  • both the audio track of the video and the wavesurfer.js webaudio stream play at the same time. (fixed with muted attribute on video element)

Hopefully this gives you some pointers on how to possibly work around those issues. The video feature in videojs-wavesurfer was a bonus feature when @katspaugh implemented waveforms for both audio and video files, so it was never my intention to support a use-case like yours, but feel free to open a PR if you manage to hack something together.

@thijstriemstra
Copy link
Member

Also see katspaugh/wavesurfer.js#510 for the wavesurfer related ticket.

@chinshr
Copy link
Author

chinshr commented Aug 27, 2015

@thijstriemstra thanks for your answers on viewing the video along the waveform. The 100ms offset is probably hard to get away with this approach. The other part of my question was how to provide access the the wavesurfer instance, surfer, but I guess I can add that myself. Thanks again.

@thijstriemstra
Copy link
Member

Finally found a reasonable approach to this! Use this config:

var options = {
    controls: true,
    autoplay: false,
    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,
            // options below are important ones
            backend: 'MediaElement',
            mediaType: 'video'
        }
    }
};

And you'll get something like this, all synced up:

Screenshot from 2019-03-13 02-50-41

I will update the video.html example with these changes and consider this fixed.

@salmanAhmad143
Copy link

Is there any option to change the position of wave form to the bottom of video. Please advice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants