Video playback fails if repeat filename is used

Edit #2: I think this is all being caused by the same video filename being chosen two (or more) times in a row. Any time that happens, it doesn’t play the video until a different filename is chosen. Any ideas for how to fix that?

Updated project link: Thunkable

Also mentioned here: Can't play video with same filename twice in a row · Issue #1094 · thunkable/thunkable-issues · GitHub

I have a project with a button that plays one of four videos at random. The videos are each approximately one second long. I’d like to have it so that when you click the button, it always plays a video. But currently, it doesn’t quite do that. Instead, sometimes it just does nothing when I click the button. This happens in a browser Preview and in Thunkable Live on an iPhone 11.

I’ve tried different wait block values (1 second, 1.5, 3) and none of them seem to make much difference. I’ve also tried it without a wait block. Again, it works most of the time but not always. It’s inconsistent.

Here’s a video showing the problem (I tap the Roll button four times but it only plays two videos):


Here’s the code:

I’m setting the Video value to an empty string ("") because without that it won’t play a video at all if the filename matches the current setting (e.g. if Video is set to “” and it randomly picks “” again). Or so I thought! That doesn’t appear to actually do anything in further testing.

Edit: I also tried adding a wait block between the set Video1's Video and set Video1's Play blocks but that doesn’t seem to help much.

And the project:

1 Like

Okay, I got it to work by adding a wait block (even 0 seconds fixes it):

It would be nice not to have to use a workaround, though.


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.