muxinc / videojs-mux-kit

MIT License
33 stars 11 forks source link

Changing src doesn't change the preview image #64

Closed stflory closed 2 years ago

stflory commented 2 years ago

Using the below code:

      this.videoPlayer.src({
        src: newSrc,
        type: 'video/mux',
      });

The video player's preview image is not updated. But if you click play, the new (correct) video plays. Calling load() doesn't fix it either.

erikpena commented 2 years ago

Hello @stflory, If you're expecting the poster image to change after you change the player's src, you also need to set the poster as well. This can be done in the same logic flow that you're doing for setting the src. Take a look at the following Repl.it example to see how it's done—

https://replit.com/@erikpenamux/videojs-mux-kit-64

Start the playback of the player (by clicking the big play button) and then while the video is playing, click the "Change content" button to see it change the src and poster.

stflory commented 2 years ago

@erikpena worked like a charm. Thanks for the answer and help!