Closed christianwach closed 9 years ago
I've wrapped the above code into a plugin for testing this more easily. Requires the slider-control branch to work: https://github.com/christianwach/cbox-slider-video-fixes
Wanted to add that I haven't included the YouTube API code in the PR because each video service that oembed
supports needs to be supported individually. This PR allows the plugin above to be developed with a view to integrating once it supports enough services. Anyone had a chance to test yet?
PR looks fine to me.
Remove the blank lines for lines 208 and 222 and you got yourself a merge!
@r-a-y Done. Also removed the redundant and commented-out auto
option.
Thanks Christian!
I've been making progress with #207 for a client project but can't get the bxSlider API to function without the changes to the way it's being initialised. When inited with
auto = true
, subsequent calls tostartAuto()
andstopAuto()
fail silently, so this PR issuesstartAuto()
directly after the slider init. This does not change how the slider behaves, but does enable starting and stopping the slideshow via code.The PR also introduces a global scope variable
cbox_slider
which is the slider instance because there are no methods of retrieving the bxSlider instance in its API. This variable means that the slider can be addressed and controlled externally, which is necessary for making it play better with videos.At present, I have only got the slider to work better with YouTube videos, but it looks like it's possible to do this with Vimeo too. Here's how to get things working...
In 'functions.php' or in a plugin, add the following filter which enables the YouTube API on the videos that are embedded in the slider:
Next, enqueue the following Javascript on the homepage:
What you should see is that playing a YouTube video now pauses the slideshow, whilst pausing it restarts the slideshow. And when a video finishes, the next slide is immediately loaded.
I'd like to add a number of filters (or one monolithic filter) that allows the bxSlider init in 'engine/includes/feature-slider/setup.php' to be more adaptable. Thoughts?