verbb / craft-videoembedder

MIT License
17 stars 14 forks source link

403 Errors when Vimeo video has restrictions #7

Open ryanmasuga opened 6 years ago

ryanmasuga commented 6 years ago

Hi Mike -

I set Vimeo videos to be hidden on Vimeo and only show on certain domains, including my local domain (e.g., mysite.local). If I grab embed code directly from Vimeo and paste into template, the video plays fine, but using any videoEmbedder code results in 403 errors.

For example, putting either of these variables on the template results in the error:

{% set video = craft.videoEmbedder.getEmbedUrl(entry.video) %}
{% set thumb = craft.videoEmbedder.getVideoThumbnail(entry.video) %}

(Where entry.video = "https://player.vimeo.com/video/123456789")

Invalid url 'https://player.vimeo.com/video/123456789' (Status code 403)

(Doesn't matter if I use an entry variable or put a string in there myself).

However, if I directly paste the following into the template, it works as expected, and the video displays on mysite.local:

<iframe src='https://player.vimeo.com/video/123456789' 
  frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>

Any idea about the difference in how the plugin is getting the video info, and just hardcoding the video info in the template?

mikestecker commented 6 years ago

Hey @ryanmasuga! Sorry I suck at responding sooner. In my quick googling of this, it seems that I'd have to add integration with their API. I'm not super strong at PHP (as I'm sure you can tell) but if I can find some time I might be able to mess around at trying to figure out how to do this. I'd likely have to add a new settings config to store an access token and the user who has the token would still have to access to viewing the video.

It might be more worthwhile for me to figure out how to "fail" better and let the user know on the front-end that the video was private and it wouldn't work. If you have any ideas too I'm all ears!

As for the question about how the plugin is getting info, it's pretty simple actually. I'm just using the Embed library which spits out the info for me. Before the URL is passed to the library, I'm just doing some simple checks to make sure it's only Vimeo or YouTube.

Hope that helps! Feel free to fork and modify the code if you want to help add anything :)

McCrisp commented 5 years ago

Any progress on this? Currently stuck with some pages being unaccessible due to private videos..