Youtube Video Playing After Popup Closed

Hi all,

Appreciate the help in advance!

The Problem
I’ve got a popup connected to a repeating group. I have a video visual element in the popup with dynamic youtube ID linked to the repeating group. All works well except when the video is started and the user closes the popup, the video keeps playing!

Solutions Tried:

  1. I’ve been researching this a lot and Emmanuel had some good posts from 4 years ago about resetting the popup group data but I’ve tried that and it’s not working.

  2. Someone else posted about creating a group with the type of content set to “video” but when I tried this there literally isn’t a “video” option for type of content.

More Details

  • You can see the video in action by going to my app at onedegreecareers.app
  • Username = “beta”
  • Password = “user”

The video is after the intro screens, when you press “More Info” to bring up the popup.

Any thoughts?

2 Likes

@gbensimo

Seeing the front end does not provide details on how things work in the back

As a general approach to display a video onto a popup from an rg these could be the steps to be taken:

  • set the popup to be of type text and not to be closed by pressing “esc” (this will give us control that the popup be closed via an action that we control)
  • also set a “close” icon (… like an “X”) and set an action to hide the popup when pressed … and prior to this one to reset the popup’s text
  • set the video element data source to be the parent group’s text (which is the popup’s text)
  • clicking the rg row should (1) reset the popup’s text (it is always a good practice to empty things first), (2) set the youtube id which at the end of the day is a text onto the popup’s text
  • now the user can press play on the video and the video will play …
  • and to close the popup the only way to do it would be to press “X” that resets the popup’s text and closes the popup

Hope this helps :grinning:

Hey, @gbensimo,

You can try having a condition When This Video isn´t visible and change the Video ID to 1 :grinning: :computer:

9 Likes

For the record, I love you. I spent hours trying to figure this out but didn’t venture too far down the conditional route because I was worried changing the Video ID via a conditional statement would rewrite to the database (it doesn’t). So the video stops playing now when the popup is exited and the original video ID is preserved.

Thank you so much @hacker!

1 Like

Appreciate the thoughtful response. Turned out the conditional statement that @hacker posted worked the first time. I wanted to try the easier method first. Thanks!

Another way I made it work is by using the HTML element.
For example, if you are using a youtube video;

  1. Add an HTML element inside a popup.
  2. Get the embed code for the video and add it to the HTML element.
  3. Check the “Display as HTML checkbox” window.
  4. Add a condition to the same HTML element where: "when this HTML element is not visible, then HTML is blank.
    See screenshot below

This means that when the popup is closed the HTML isn’t visible and the HTML code will become blank, which will stop the video from playing.

What do you think of this approach?

2 Likes

This is brilliant as I just happened upon this problem, and you solved it for me!

Thanks!
–Treb