craft-videoembedder icon indicating copy to clipboard operation
craft-videoembedder copied to clipboard

Undefined property: stdClass::$providerName when using Vimeo

Open thijskaspers opened this issue 5 years ago • 1 comments

When using a Vimeo URL, we get the following error using the getProviderName method:

Undefined property: stdClass::$providerName

Code is as follows (copied from the example in the documentation for plyr):

{% set videoUrl = 'https://vimeo.com/76979871' %}
{% set videoId = craft.videoEmbedder.getVideoId(videoUrl) %}
{% set providerName = craft.videoEmbedder.getProviderName(videoUrl) %}

{% if videoId | length %}
    <div id="player" data-plyr-provider="{{ providerName | lower }}" data-plyr-embed-id="{{ videoId }}"></div>
{% endif %}

YouTube works, but Vimeo gives this error. Using Video Embedder v1.1.4.

thijskaspers avatar Jan 13 '20 13:01 thijskaspers

yea, I am getting the same issue. The code needs to be updated in the file VideoEmbedderVariable.php line 113 –– return Template::raw(VideoEmbedder::$plugin->service->getInfo($url)->provider_name);

Slgoetz avatar Feb 10 '20 20:02 Slgoetz