Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] Add baseUrl option #89

Closed
juanamd opened this issue Nov 30, 2020 · 13 comments
Closed

[Request] Add baseUrl option #89

juanamd opened this issue Nov 30, 2020 · 13 comments

Comments

@juanamd
Copy link

juanamd commented Nov 30, 2020

Hi,

I was wondering if it would be possible to either:
-Enable an optional prop to set the 'baseUrl' property of the WebView's source prop
-Set (hardcode) the baseUrl to "https://youtube.com" as this solves the "video unavailable" issues.

I only barely tested it on an Android emulator and it works for me but wasn't sure if this was intentionally omitted as an option for other reasons.

@LonelyCpp
Copy link
Owner

Hey, I've added a provision to specify baseUrl

...webViewProps?.source,

  1. point your package.json dependency to the master branch

    "react-native-youtube-iframe": "https://github.com/lonelyCpp/react-native-youtube-iframe#master"

  2. and specify it like this -

     webViewProps={{
        source: { baseUrl: "https://youtube.com" },
      }}

@LonelyCpp
Copy link
Owner

let me know if it works for you

@juanamd
Copy link
Author

juanamd commented Nov 30, 2020

Tried using master but fails with:
"'rm' is not recognized as an internal or external command,"

I'm on Windows and it seems that this commit is not entirely compatible with my setup.

@LonelyCpp
Copy link
Owner

ah damn, makes sense. I will patch this soon

@LonelyCpp
Copy link
Owner

LonelyCpp commented Dec 1, 2020

@juanamd, the master branch now uses rimraf. can you try now?

@juanamd
Copy link
Author

juanamd commented Dec 1, 2020

Now it works, thanks!
The only issue I see now is that some typedefs appear to be outdated as I get this error:

Type '{ baseUrl: string; }' is not assignable to type 'WebViewSourceUri | WebViewSourceHtml | undefined'. Property 'html' is missing in type '{ baseUrl: string; }' but required in type 'WebViewSourceHtml'.

@LonelyCpp
Copy link
Owner

LonelyCpp commented Feb 26, 2021

closing this in favour of baseUrlOverride

This will also fix the video unavailable issues (see #98 for more info)

@juanamd
Copy link
Author

juanamd commented Mar 31, 2021

Recently switched to the latest version and found out that this solution is no longer available.
Although I like the new "remote hosted" solution since it's multiplatform, as I'm only using Android I would prefer if this previous solution was still available.

I played a bit with the code and basically the only change that would be required is to change this line to:
{html: ytScript.htmlString, baseUrl: baseUrlOverride};

This would enable baseUrlOverride with useLocalHTML.

Could do a PR but seemed easier this way for half a line of code.

@LonelyCpp
Copy link
Owner

LonelyCpp commented Mar 31, 2021

baseUrl: baseUrlOverride

ya this changes does make sense. PRs welcome! :)

But I'm curious why you would want this since the hosted solution will solve all "video unavailable" problems

@juanamd
Copy link
Author

juanamd commented Mar 31, 2021

Just being nitpicky mostly...
If the default host (GitHub pages I believe?) is down/unreachable then the videos will stop working. Or maybe there is an update to the script which breaks something in the future...
I know, I know, both quite unlikely, but if I can have a local solution that works then it reduces the points of failure I guess.

@LonelyCpp
Copy link
Owner

gotcha

@LonelyCpp LonelyCpp reopened this Mar 31, 2021
@LonelyCpp
Copy link
Owner

fixed here - d4a28b1

available on v2.0.1

@juanamd
Copy link
Author

juanamd commented Apr 1, 2021

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants