React-player: Start player from specific time

Created on 26 Jun 2018  路  9Comments  路  Source: cookpete/react-player

Hey, Great work!

How can I make the player start from a specific time?

Thanks =)

Most helpful comment

how can i write the config for a normal file?

I am wondering about this too. Tried a couple of ways, for example seeking when onReady, but the player just resets played to zero.

I've found a solution that may help someone using media fragment

Media Fragments
Adding a media fragment to the media URL, you can specify the exact portion you want to play. To add a media fragment, you simply add #t=[start_time][,end_time] to the media URL

ref={this.ref}
url={${source}#t=${this.state.duration * this.props.played}}
/>

I'm passing played as prop to the player component, that I retrieve from the db stored

All 9 comments

@msbir what URL type are you trying to play? Each player API has a different config to start at a certain time.

Thank for the response

I am trying to play youtube type

See https://github.com/CookPete/react-player/issues/115, although the config example is outdated:

<ReactPlayer
  url='https://youtu.be/qv6UVOQ0F44'
  config={{ 
    youtube: {
      playerVars: {
        start: 33
      }
    }
  }}
/>

Thank you!

No problem!

how can i write the config for a normal file?

how can i write the config for a normal file?

I am wondering about this too. Tried a couple of ways, for example seeking when onReady, but the player just resets played to zero.

for me as well, how I can set a starting time? seeking onStart and onReady will be start from 0 once is loaded

Thanks

how can i write the config for a normal file?

I am wondering about this too. Tried a couple of ways, for example seeking when onReady, but the player just resets played to zero.

I've found a solution that may help someone using media fragment

Media Fragments
Adding a media fragment to the media URL, you can specify the exact portion you want to play. To add a media fragment, you simply add #t=[start_time][,end_time] to the media URL

ref={this.ref}
url={${source}#t=${this.state.duration * this.props.played}}
/>

I'm passing played as prop to the player component, that I retrieve from the db stored

Was this page helpful?
0 / 5 - 0 ratings

Related issues

intelligence picture intelligence  路  3Comments

denishrana09 picture denishrana09  路  3Comments

rebelliard picture rebelliard  路  3Comments

Thargarius picture Thargarius  路  3Comments

samuelbriole picture samuelbriole  路  5Comments