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

How to get latest iframe Youtube js? #10

Open kesha-antonov opened 4 years ago

kesha-antonov commented 4 years ago

Hey!

Thanks for the awesome lib! How to get updated iframe api that you hold in html var? https://github.com/barmej/react-native-youtube-player/blob/master/src/mobile/YTWebView.tsx#L64-L65

I'm making custom component based on your lib and setPlaybackRate is not working

kesha-antonov commented 4 years ago

I added setPlaybackRate method https://github.com/barmej/react-native-youtube-player/compare/master...kesha-antonov:add_setPlaybackRate?expand=1

Made build yarn build:web

Replaced old version with web/dist/index.html

And I see blank screen

Please help. What am I do wrong?

kesha-antonov commented 4 years ago

Although if I manually add method in old build - it works on(){})}),a.default.define("seekTo",function(e){r.seekTo(e).then(function(){})}), a.default.define("setPlaybackRate",function(e){r.setPlaybackRate(e).then(function(){})})},{"youtube-player":"QbF1","react-native-webview-invoke/browser":"vPwy"}]},{},["Focm"]);

yjose commented 4 years ago

you got it, we still need to use a build system for the web part. for now, you need to build the web part and copy it manually to the html const https://github.com/barmej/react-native-youtube-player/blob/master/src/mobile/YTWebView.tsx#L64

I will work to automate this process ASAP, and please let me know if you can open a PR to provide a solution for this?

yjose commented 4 years ago

the idea was to use webpack or parcel and build the web part to a file like the following :

// Html.js
export const Html = ` html here `

so in the YTWebView.tsx we only need to import it.

kesha-antonov commented 4 years ago

@yjose Agreed Seems like not a difficult task. Thing is that when I added that method, made build - yt video stopped working. No errors arised