souporserious / react-media-player

React audio and video player.

Home Page:https://souporserious.github.io/react-media-player/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to seekTo on componentDidMount

xpluscal opened this issue · comments

Hi,

I'd like to seekTo a certain time when my Media component ist loaded.
I do not use a custom player, but this:

export default MediaPlayer = withMediaProps(withMediaPlayer(MediaPlayer));

and inside the MediaPlayer component I use this to seekTo the time set via Redux:

componentDidMount(){
    let that = this;
    if(this.props.startTime && this.props.media){
      that.props.media.seekTo(that.props.startTime);
    }
  }

Any ideas what could be wrong?
Thanks

Sorry, I just saw this issue. Can you provide anymore code? Maybe the whole component so I can get an idea of what's going on? I've been thinking about adding a startTime prop or something similar to define when the video should start playing similar to how Youtube allows you to set a start time.