Youtube video player

Anyone know why a link like:

https://www.youtube.com/watch?v=EHoZ-LofjkI

will work with Bubble’s video player but not with a time parameter like:

https://www.youtube.com/watch?v=EHoZ-LofjkI?t=323s

image

?

Also, the video player doesn’t work with links generated from Youtube’s share button, like this: https://youtu.be/EHoZ-LofjkI

Hi @rhea
Bubble video element expects video ID which is v=EHOz-Lofgjh
It won’t recognise id from the url by default (you have to extract id using regular expression)
You can read more about video element here
https://manual.bubble.io/core-resources/elements/visual-elements#video

I was asking this because I wanted to supply the time parameter programmatically.

@rhea I think for that you need to use video player plugin

Thank you for the info!

1 Like

I know this is a little old but here are two links to other members who had similar issues with regex and getting the correct data out:

This regEx pattern I find is the best. Extract with Regex empty - #11 by sudsy

This is useful if you want to get the image also:

What I did was this:

I have a standard Youtube element and pull in the a custom field from the database:

When saving the input to the database I use regex on this to extract and only save the youtube ID:

image
(?<=v=|v/|embed/|be/)([^&?]+)

I also show an alert if the input is invalid using the same regex but looks to see if the regex didn’t return anything - which i determine is invalid, but you may have your own ideas here.
image

3 Likes

This topic was automatically closed after 70 days. New replies are no longer allowed.