Beginner looking for help/advice in building "Shake Me" app

aia
beginner

#1

Hello,
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?
Thanks guys


#2

Hi there,

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?

Thanks!


#3

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,
Thanks!
Edit: Edited title so its more descriptive.


#4

@G_Musik, I like the new title - one of the best I’ve seen in a while! :slight_smile:

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
http://thunkable.com/reference/components/media_components.html


#5

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 :grinning:
As for the GIF, I converted it to mp4 but it doesn’t play at all.


#6

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…


#7

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.

  1. Is it the shaking event? Can you play the video with, for example a button click?

  2. Where do you set the source of the VideoPlayer? Have you tried setting it in both the designer and in the blocks editor.

  3. 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.

source: http://thunkable.com/reference/components/media_components.html

4, Have you tried using a .mp4 from a demo app or tutorial that is known to work?


#8

@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)


Best Regards


#9

@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:


#10

@Brainwork Hi, thanks for the advice, but I did this by following the Accelerometer Sensor #BestPractices article, here is the block section from the article:


#11

@G_Musik

I take a look into it what you want to do and this is my solution :slight_smile:
It works! :slight_smile:

Solution 1: (one shake = play video, more than one shake = video is paused)

Download shake_me (aia file)
Download shake_me (apk test file)


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)

Download shake_me_2 (aia file)
Download shake_me_2 (apk file)

best regards,
Mika

Tutorials, Snippets, Examples with source files (aia and apk) and much more available on my blog


#12

@Mika Wow… awesome!
Thanks man, I’m going to try this right now!


#13

Let me know it if this is what you was looking for. :slight_smile:


#14

oh ok! as long as it works well for you i think you are good to go!
Best Regards
Albert