barmej / react-native-youtube-player

A Cross-platform Youtube Player component for React Native Built using the official YouTube IFrame Player API.
128 stars 49 forks source link

Could this support providing start/end times on videos? #8

Open ElixirMike opened 4 years ago

ElixirMike commented 4 years ago

I'm looking at implementing this, as I've had the issue with react-native-youtube freezing due to overlay problem with react-native-navigation. Hoping this solution might solve it.

In regards to this API, would it support providing a start/end time for the video, as youtube URL's support this?

yjose commented 4 years ago

Hi @ElixirMike,

You can add any Youtube Iframe function and should work correctly using react-native-webview-invoke

check this example of how you can add ChangeQuality:

//src/web/index.js

....

const createPlayer = () => {
....
}
invoke.define("createPlayer", createPlayer);

const changeQuality = (opts) => {
 //https://developers.google.com/youtube/iframe_api_reference#Playback_quality
 player.setPlaybackQuality(opts)
}

invoke.define("changeQuality", changeQuality);
//src/mobile/YTWebView.tsx

....

export default class YTWebView extends Component<YTWebViewProps> {

   ...

  _createPlayer = this.invoke.bind("createPlayer");
  _changeQuality = this.invoke.bind("changeQuality");

}

lets me know if you need more help to implement a start/end time for the video.

ElixirMike commented 4 years ago

Thanks yjose, just getting back to this. I'm sure how to process this.....could use your help? Or could you add start/end time parameters to the player? That would be ideal :)

yjose commented 4 years ago

Not sure if I can do it in the upcoming weeks because I don't have enough time to do it for now, but for sure I will try to make it ASAP.

hitesh25kumar commented 4 years ago

I also wanted this feature it would be helpful to see that soon

Anusha-Gurajapu commented 3 years ago

Any positive update on this feature ? I also want this feature.