Closed Tarek-Adra closed 10 months ago
@Tarek-Adra hey man, thanks for reaching out and sorry for a year long wait for a reply. Hopefuly you've found the solution by yourself.
What you can do is search for the iframe of the player, or the video element within the element wiht data-vbg
and change it's source attribute.
This is a great idea to have the reinitializer function. I'll leave this issue open so I can add it.
@Tarek-Adra hey man! I've made the update as of v1.1.0 and added the functonality to the code so you can change the URL on the fly, if the URL is from the same video provider as the previously initialised URL.
To do so you'll have to get the data-vbg-uid
attribute value and then get the instance of your video background in a global variable if you are using jQuery window.VIDEO_BACKGROUNDS.index[uid].serSource(URL)
. This will programatically change the source.
If you want to use a vimeo link and previously you used youtube, then you'll need to destroy the instance window.VIDEO_BACKGROUNDS.index[uid].destroy()
first and then change the 'data-vbg' atrtibute and reinitialize it window.VIDEO_BACKGROUNDS.add($('.YOUR-ELEMENT')[0])
.
You can see how these functions were implemented in the demo.
In the v1.1.1 I'll add the setStart
and setEnd
time and video-background-destroyed
event, since I forgot about it... And I'll try to complete the documentation!
Cheers! ☺️
there's any option to update the video URL, I tried to change data-vbg attribute and call jQuery('[data-vbg]').youtube_background() without any luck