nice_build_url() function breaks is default YouTube embed code is passed
This support request was posted in Flatbase by Lost Motion Assembly
- Lost Motion Assembly November 8, 2014 at 6:29 pm
It looks like nice_build_ur() expects a scheme to be specified when passing a YouTube embed code. However, YouTube’s embed code doesn’t actually specify a scheme (perhaps YouTube changed something recently). Here’s a sample embed code:
Note the `src` attribute doesn’t include a scheme. This results in a ‘undefined index’ error. The user can work around this by editing the embed code to include a scheme, but the function should allow for YouTube’s default lack of a scheme.
Juanfra Aldasoro November 8, 2014 at 10:22 pmHi,
Thanks for writing. Unfortunately the code is not copied properly.
Would you please create a gist on github? http://gist.github.com
That way we can take a look at it.
Best,
Juan.Juanfra Aldasoro November 10, 2014 at 3:54 pmHi,
I can see what you mean now. Yes, recently YouTube started giving their embed codes without the http protocol in the urls. I don’t know the reason, but it actually doesn’t work.
You can even try to create a simple html with the code that they are currently providing and you’ll see the results in the browser: https://gist.github.com/juanfraa/b1498483569e51022a3c
We’ll take a look at this issue and see if we can apply a patch.
Best,
JuanLost Motion Assembly November 10, 2014 at 4:31 pmIt looks like YouTube has switched to using a protocol-relative URL scheme as part for their migration over from HTTP to HTTPS. I haven’t dug too deep, but it sounds like this is supported by most modern browsers. At first blush I’d guess you’d want to refactor the function slightly so that the `$scheme` variable is optional.
Juanfra Aldasoro November 11, 2014 at 5:04 pmYes, thanks for the suggestion. We’ll need to find a solution.
Have a nice day,
Juan.
This topic is marked as resolved
Only the topic author can re-open this thread.