wrav / oembed

A simple plugin to extract media information from websites, like youtube videos, twitter statuses or blog articles.
MIT License
37 stars 36 forks source link

Youtube autoplay or mute options not working #29

Closed migswd closed 4 years ago

migswd commented 4 years ago

I am trying to add the autoplay and mute options to my youtube embed but it does not work.

Here is my options defined :

{% set url = entry.oEmbedField %}
{% set options = {
  autoplay: 1,
  mute: 1
} %}
{{ craft.oembed.render(url, options) }}

And the resulted HTML :

<iframe 
    width="480" 
    height="270" 
    src="https://www.youtube.com/embed/cfcHQA175g8?feature=oembed" 
    frameborder="0" 
    allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" 
    allowfullscreen=""></iframe>

Thanks for your help.

reganlawton commented 4 years ago

@migswd are you using the plugin with cache enabled in the plugin settings?

migswd commented 4 years ago

No cache is disabled. CleanShot 2020-01-24 at 07 46 42@2x

reganlawton commented 4 years ago

What version are you running?

migswd commented 4 years ago

oEmbed 1.1.8 / Craft CMS 3.3.20.1

reganlawton commented 4 years ago

Have you tried the new 1.2.x releases?

migswd commented 4 years ago

Not yet. OK I m going to try today.

migswd commented 4 years ago

I got a problem updating oEmbed (I succeeded to do 4 other plugins update but oEmbed update has a problem). I also tried to remove the plugin completely and reinstall it from scratch but got same problem :

Composer output: Package "craftcms/vue-asset" listed for update is not installed. Ignoring.
Package "danielstjules/stringy" listed for update is not installed. Ignoring.
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
- laravel/helpers v1.1.1 requires php >=7.1.3 -> your PHP version (7.2.21) overridden by "config.platform.php" version (7.0) does not satisfy that requirement.
- laravel/helpers v1.1.0 requires php >=7.1.3 -> your PHP version (7.2.21) overridden by "config.platform.php" version (7.0) does not satisfy that requirement.
- wrav/oembed 1.2.0 requires laravel/helpers ^1.1 -> satisfiable by laravel/helpers[v1.1.0, v1.1.1].
- Installation request for wrav/oembed 1.2.0 -> satisfiable by wrav/oembed[1.2.0].

Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.
migswd commented 4 years ago

OK I succeeded to update oEmbed in 1.2 release.

Here the solution : Check for this section of your composer.json and change the PHP version to >=7.1.3

So here the right code for Craft composer.json :

  "config": {
    "sort-packages": true,
    "optimize-autoloader": true,
    "platform": {
      "php": "7.1.3"
    }
  },
migswd commented 4 years ago

OK it is working the first time I display a Youtube or TED Talk video, not working for a Facebook video. And it breaks the html elements that are following the iframe, dont know why. I need to make a minimal page so I can debug precisely and give you more infos...

reganlawton commented 4 years ago

@migswd can you post the URL your using? I should have a release in a minute that will be a new way to modify the iframe URL to enable features like mute that are't supported byut the providers oembed protocol