Page 1 of 1

Play MP3 file on Android and IOS and Image resizing

Posted: Mon Aug 31, 2015 2:48 pm
by dabir0070
I am new to this, and just started working with mobile apps. I have two problems to overcome, and I guess if I can understand these then I am well on my way to understanding how LC works (wishful thinking).

I have a stack with a Button, with the following script:-

on mouseUp
put "./myFile.mp3" into tPath
set the DONTUSEQT to true
set the filename of player "Player" to tPath
set the currentTime of player "Player" to 0
start player "Player"
end mouseUp

Now, this works on my windows PC. When I install it on the Samsung S6 android, I get no sound when I play, even though I add the mp3 file in the preferences "Copy Referenced Files".

The second problem is I have an image which I simply cannot get it to resize on the android device. I want the user to make the image smaller and larger using their thumb and forefinger, but I cannot work out how I can do this

Re: Play MP3 file on Android and IOS and Image resizing

Posted: Mon Aug 31, 2015 3:20 pm
by Klaus
Hi dabir0070

1. welcome to the forum! :D

2. PLAYER objects are NOT supported, so you need to use PLAY on the mobile platform.
And there is no QuickTime for mobile also!

Do this, but this will NOT work on the desktop, only on mobile!

Code: Select all

on mouseUp
  put specialfolderpath("engine") & "/myFile.mp3" into tPath
  play tPath  
end mouseUp
3. What did you try so far with your second problem?


Best

Klaus

Re: Play MP3 file on Android and IOS and Image resizing

Posted: Mon Aug 31, 2015 4:10 pm
by dabir0070
I will give the player a go. Meanwhile on the image resizer I did this:-

On the image resize problem I added a "resize" object from h t t p://livecodeshare. runrev. com/stack/76/Image-Resize-Control and I had the following script to my image:-

on mousedown
hide group "resize"
grab me
end mousedown

on mouseup
set the loc of group "resize" to the loc of me
show group "resize"
end mouseup

The follow up question is how do I make my image and stack to resize automatically to the screen size of the mobile phone? Also, when I rotate my mobile phone my stack and image remains static. How do I get the stack to rotate with the mobile?

Further reading I found the tutorial to make the use of the fullscreenmode property. But this only applies to the stack not the image

Re: Play MP3 file on Android and IOS and Image resizing

Posted: Tue Sep 01, 2015 1:22 pm
by Klaus
Hi dabir0070,

hm, could not get the "Image-Resize-Control" stack to work!?

Pllease check this and all other lessons here:
http://lessons.runrev.com/m/4069
http://lessons.runrev.com/m/4069/l/1150 ... nch-motion
This example uses a simple graphic, but will also work with an image!



Best

Klaus

Re: Play MP3 file on Android and IOS and Image resizing

Posted: Tue Sep 01, 2015 6:55 pm
by dabir0070
Thanks Klaus, sorry but I have another question. I have the square graphic, how do I put an image into it? I am trying to get my image to resize, but this is only resizing the square graphic. My guess is if I can find a way to put my image.jpg into the square then the image will resize

Re: Play MP3 file on Android and IOS and Image resizing

Posted: Tue Sep 01, 2015 7:02 pm
by Klaus
Hi dabir0070,
dabir0070 wrote:I have the square graphic, how do I put an image into it?
you can't! 8)
Use an image INSTEAD of the graphic!

Do this:
Import an image into the stack, resize it to fit the card, if neccessary, and check the "lockloc" of that image in the inspector.
Maybe this option reads "Lock size and postion" for you.

Then replace all occurrences of ->
graphic "square"
with ->
img "your image name here"
in the script of the lesson and it should work.

You can then delete that cheap graphic! :D

Hint:
Please check these great stacks to get mor of the basics of Livecode:
http://www.hyperactivesw.com/revscriptc ... ences.html

Best

Klaus

Re: Play MP3 file on Android and IOS and Image resizing

Posted: Tue Sep 01, 2015 8:26 pm
by jacque
Actually you can set the backpattern of an opaque graphic to the ID of an image, but it will repeat if the graphic isn't sized exactly to fit, and it requires that the image has been imported anyway. So Klaus is right that just using the image itself is the best way.