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

Quality change #2

Open sankhadeeproy007 opened 5 years ago

sankhadeeproy007 commented 5 years ago

Hi, thanks for the package. Does this support the option to change the quality of the video?

yjose commented 5 years ago

Hi @sankhadeeproy007. Unfortunately, The package didn't support changing Quality of the Video for now.

The good news is you can add any Youtube Iframe function and should work correctly using react-native-webview-invoke

//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 the option to change the quality.

sankhadeeproy007 commented 5 years ago

Great! Thanks for the solution, I'll try that out.

marksturm commented 4 years ago

Heya - very nice lib! But really, where is the right place to call the _changeQuality ? That is really the missing part of this great lib

ramkumar2098 commented 2 years ago

setPlaybackQuality is no longer supported. https://developers.google.com/youtube/iframe_api_reference#october-24,-2019