Try CumulusClips Cloud Hosting

auto play on embed

Hello

How can one have the video that is embedded to auto play?

Comments

  • You meed to add autoplay: true to the video options in embed.phtml. See this link for a complete list of options available to the video player:

    http://docs.videojs.com/docs/guides/options.html
  • okay

    What if I just want some videos to auto play in some embeds, is this possible?
  • Yes it is possible. You would have to write some PHP code that adds the autoplay: true based on your desired conditions.
  • I am not a coder, can you please provide some hints on how to go about this?
  • You have not specified what conditions you want the autoplay to appear in. We need that in order to get you any code.
  • Okay

    My question was about having the embed video auto play; The answer was to replace false to true in embed.phtml, that works fine!

    Then I will like to have an option to NOT auto play whatever video I want; One case be, I have a few videos on one page by having auto play to true all of them will play at the same time (those i don't want to do that) and then I have just one video on another page (This video I want it to auto play)

    I hope that I was clear, Thank you!
  • hello

    Have you forgotten?
  • In the file /cc-content/themes/[your-theme]/embed.phtml, on line 31 there is a piece that says "autoplay: false". Replace the "false" with this:

    <?php echo (isset($_GET['autoplay'])) ? 'true' : 'false'; ?>
    This will detect if the user requested autoplay to be turned on for that particular embed. Then simply add "?autoplay=true" to the URL of the embed code so that the video URL looks like this:

    http://www.yoursite.com/embed/12345/?autoplay=true

    This will allow you to have numerous embedded videos on a page and only have a specific one play automatically if it has autoplay=true in it's embed URL.
  • Hello

    It works great!
    Thank you very much!
Sign In or Register to comment.