Recently I discovered thunkable, so I started playing around. Just for fun I am trying to recreate the “Shake Me” app with the funny batman GIF.
So my problem is: when I set a video and sound to play when accelerometer1 is shaking, the mp3 file starts playing but the video doesn’t start. Also if I shake the device again the mp3 starts playing again and overlaps with itself. In the “Shake Me” app, when you shake the device the video and sound start simultaneously and stop playing as soon as you stop shaking the device.
Any ideas on how I could recreate this effect on thunkable?
You should be able to achieve this without too much trouble. Have you read the Accelerometer #BestPractices article yet? It includes an example of how to handle the shaking event.
If this hasn’t worked for you, can you share what you’ve done so far please?
Hello, thank you for your answer.
Yes, I have read the Accelerometer #BestPractices article, but I am still stuck in the same situation.
I am uploading a screenshot of my blocks, and I will be happy to hear any advice from you guys,
Edit: Edited title so its more descriptive.
@G_Musik, I like the new title - one of the best I’ve seen in a while!
What tutorial are you working from, can you share a link please?
One of the sources of the problem could be if you are using an animated gif:
If you have a look at the docs, the only supported formats are .3gp and .mp4
I’m not really working from any specific tutorial. The “Shake Me” app looks simple, so I thought it would be easy building something similar… Turns out it’s not that simple I guess
As for the GIF, I converted it to mp4 but it doesn’t play at all.
Ok, so I have a little update: I have merged the mp3 and mp4 into one mp4 file. The problem is when I shake the phone only the sound plays, the video doesn’t appear at all…
I must be missing something somewhere but what and where? Mystery…
You need to work the problem! Start by going through all the possible causes of of the error and see if you can narrow it down a bit.
Is it the
shakingevent? Can you play the video with, for example a button click?
Where do you set the source of the VideoPlayer? Have you tried setting it in both the designer and in the blocks editor.
What size is your video file?
Thunkable for Android only permits video files under 1 MB and limits the total size of an application to 5 MB, not all of which is available for media (video, audio, and sound) files.
4, Have you tried using a .mp4 from a demo app or tutorial that is known to work?
@G_Musik i don’t think this will probably solve your problem but kindly take a good look at your if_Statement block in when screen.initialize. Your last block Set Label.Text to Join … should be part of the Else portion of your if_statement block otherwise if the Accelerometer is not available, the notifier will pop up and also the setLabel.Text will be displaying a massage indicating it is available.(that would confuse your users)
@Domhnall Aw… my MP4 file was too large. Now I have uploaded a smaller MP4 (under 1 MB) and it works perfectly! Thank you again, mate!
Edit: Now the MP4 video plays when I shake the phone but doesn’t stop playing when I stop shaking it. So now I am trying ridiculous things like:
I take a look into it what you want to do and this is my solution
Solution 1: (one shake = play video, more than one shake = video is paused)
Solution 2: (shake = play video, stop shaking = video is paused)
(but i think that the first solution is the best option for a puplic app)
Let me know it if this is what you was looking for.
oh ok! as long as it works well for you i think you are good to go!