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

Youtube autoplay or mute options not working #29

Closed
migmake opened this issue Jan 23, 2020 · 10 comments
Closed

Youtube autoplay or mute options not working #29

migmake opened this issue Jan 23, 2020 · 10 comments

Comments

@migmake
Copy link

migmake commented Jan 23, 2020

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
Copy link
Member

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

@migmake
Copy link
Author

migmake commented Jan 24, 2020

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

@reganlawton
Copy link
Member

What version are you running?

@migmake
Copy link
Author

migmake commented Jan 24, 2020

oEmbed 1.1.8 / Craft CMS 3.3.20.1

@reganlawton
Copy link
Member

Have you tried the new 1.2.x releases?

@migmake
Copy link
Author

migmake commented Jan 24, 2020

Not yet. OK I m going to try today.

@migmake
Copy link
Author

migmake commented Jan 24, 2020

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.

@migmake
Copy link
Author

migmake commented Jan 27, 2020

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"
    }
  },

@migmake
Copy link
Author

migmake commented Jan 27, 2020

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
Copy link
Member

@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

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