about movie player on iOS and Android

Getting into LiveCode for iOS? Ask your questions here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

fred38
Posts: 2
Joined: Thu Jan 28, 2016 5:24 pm

about movie player on iOS and Android

Post by fred38 » Thu Jan 28, 2016 5:48 pm

hello,
I read somewhere that we could not play a video sequence in a stack or application intended to be used on iOS or Android.
Can anyone confirm or deny this?
On Macs or PC, I create a stack in LiveCode creates a video player by depositing the control for this purpose on the card from the stack and adds buttons and scripts to active or desactive  the player.
if it works what video formats mov, avi, mp4 etc ..

Same question for the sound player , and the display of a web browser
on iOS or android?

Should we store the media on the server, download them to the mobile
-in the installation package of the application or at the first execution of the application.

thanks for your answers

Klaus
Posts: 12083
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: about movie player on iOS and Android

Post by Klaus » Thu Jan 28, 2016 7:12 pm

Hi Fred,

1. welcome to the forum! :D

2. If you mean that we cannot play IMPORTED (into the stack) audio and video files on mobile,
that is true unfortunately.

On Windows Livecode still requires QuickTime to be installed on the target PC for multimedia playback.
Please check the dictionary for "dontuseqt", but I never could make multimedia work satisfyingly on Windows
without Quicktime!

And yes, on the desktop we can (pre-) create a "player" object and use it alter (set filename etc.)
On the mobile platform we need to create "native" objects on-the-fly, see "mobilecreate" in the dictionary.

Providing media with your standalone:
Even on the desktop it is a good idea to provide media files outside of the stack, since Livecode will
always load the complete stack (WITH eventual imported audio/video clips) into memory and that can
sum up with lots of video/audio files.

For this purpose you can add your (folders with) mediafiles via the "Copy files..." tab in the standalone
builder settings. Then you can access them in your standalone here -> specialfolderpath("resources")
This is the same for desktop and mobile.

Hope that helps, please don't hesitate to ask question as they arise, and they will! :D

Here some great learning resources for the very basics of Livecode:
http://www.hyperactivesw.com/revscriptc ... ences.html


Best

Klaus

fred38
Posts: 2
Joined: Thu Jan 28, 2016 5:24 pm

Re: about movie player on iOS and Android

Post by fred38 » Fri Jan 29, 2016 10:51 am

my question how to play a movie or sound in a livecode stack on mobile platform iOS or android ?
i want to renew my license for livecode (in 7 or 8), but if i can't create a player for my customers movie (or all available movie on internet) or sound the product isn't the good tool.

Klaus
Posts: 12083
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: about movie player on iOS and Android

Post by Klaus » Fri Jan 29, 2016 11:21 am

Hi Fred,

you're welcome! 8)

On mobile you can use (examples from the dictionary):
...
put specialFolderPath("engine) & "/intro_movie.mp4" into tVideoFile
play video tVideoFile
...
play video "http://www.livecode.com/buildanapp.mp4"
...

Or, for having more control over the player, you can create a native mobile video player object with:
...
mobileControlCreate "player", "your_video_player"
## and then set a lot of properties to fit your needs...
## see the dictionary for "mobilecontrolcreate"!
...

Best

Klaus

maulinarmananda
Posts: 14
Joined: Thu Mar 24, 2016 12:13 pm

Re: about movie player on iOS and Android

Post by maulinarmananda » Thu Mar 24, 2016 1:51 pm

can you please give me an example? I still don't understand with your code

Klaus
Posts: 12083
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: about movie player on iOS and Android

Post by Klaus » Thu Mar 24, 2016 2:46 pm

maulinarmananda wrote:can you please give me an example? I still don't understand with your code
Please stick to ONE posting for one problem, thank you!
http://forums.livecode.com/viewtopic.php?f=53&t=13231

maulinarmananda
Posts: 14
Joined: Thu Mar 24, 2016 12:13 pm

Re: about movie player on iOS and Android

Post by maulinarmananda » Thu Mar 24, 2016 3:55 pm

what if I put these code?

put specialFolderPath("engine") & "/video/myVideo.m4a" into tVidFile
mobileControlCreate "player", "myPlayer"
put the result into sPlayerID -- save the control id

mobileControlSet sPlayerID, "filename", tVidFile
mobileControlSet sPlayerID, "visible", true
mobileControlSet sPlayerID, "rect", "100,50,820,350"
mobileControlSet sPlayerID, "showController", true
mobileControlSet sPlayerID, "preserveAspect", true

I tried to put this on my card. when I save as standalone for android, video doesn't show, there's only rectangle come up.
How to fix this problem? and where should I put the right code? thank you

Klaus
Posts: 12083
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: about movie player on iOS and Android

Post by Klaus » Thu Mar 24, 2016 5:05 pm

.m4a is an audio codec, no video in it!?
It stands for MPEG4 Audio, so what do you exspect?

maulinarmananda
Posts: 14
Joined: Thu Mar 24, 2016 12:13 pm

Re: about movie player on iOS and Android

Post by maulinarmananda » Thu Mar 24, 2016 5:27 pm

I mean mp4. It still not working

Klaus
Posts: 12083
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: about movie player on iOS and Android

Post by Klaus » Thu Mar 24, 2016 5:36 pm

Ah, OK :D

So you added the folder "video" inclusive content to your standalone
via the "Copy files" tab in the standalone builder settings?

Add this line (maybe in a separate button?) to see if the video is really present in your standalone:
...
put specialFolderPath("resources") & "/video/myVideo.m4a" into tVidFile
answer (there is a file tVidFile)
## Should display TRUE if video is present
...

maulinarmananda
Posts: 14
Joined: Thu Mar 24, 2016 12:13 pm

Re: about movie player on iOS and Android

Post by maulinarmananda » Fri Mar 25, 2016 4:36 am

so,first I have to create player on my card, then put the code on player or on my card?
I get a bit confuse here. Can you give me all lines of the code?

I had put my video files in "copy files" but still nothing works.
and here is my code that I put in my card.

on openCard
if the environment = "mobile" then
put specialFolderPath("engine") & "/qtimun.mp4" into tVidFile
mobileControlCreate "player", "myPlayer"
put the result into sPlayerID -- save the control id

mobileControlSet sPlayerID, "filename", tVidFile
mobileControlSet sPlayerID, "visible", true
mobileControlSet sPlayerID, "rect", "30,32,414,330"
mobileControlSet sPlayerID, "showController", false
mobileControlSet sPlayerID, "preserveAspect", false

--mobileControlDo "myPlayer", "play"
--mobileControlDo "myPlayer", "pause"
end if
end openCard
mobileControlSet sPlayerID, "visible", false
on closeCard

end closeCard



is there something wrong?

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5679
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: about movie player on iOS and Android

Post by jacque » Fri Mar 25, 2016 4:45 pm

The path should be:
put specialFolderPath("resources") & "/qtimun.mp4" into tVidFile

Files in the Copy Files pane of the standalone settings are no longer stored in the engine folder.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

maulinarmananda
Posts: 14
Joined: Thu Mar 24, 2016 12:13 pm

Re: about movie player on iOS and Android

Post by maulinarmananda » Fri Mar 25, 2016 5:02 pm

waw thank you so much. it works! :D
But I have one problem, when I click back button (go to the prev card), my video is still on the screen, doesn't want to go. How do I fix it?

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5679
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: about movie player on iOS and Android

Post by jacque » Sat Mar 26, 2016 6:56 pm

If you go back and read Klaus' reply, he suggested the same specialFolder. ;)

You need to delete all instances of mobile controls on closeCard, and recreate them on openCard. Mobile controls are not card objects, they are drawn on top of the stack and you have to manage them yourself.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

maulinarmananda
Posts: 14
Joined: Thu Mar 24, 2016 12:13 pm

Re: about movie player on iOS and Android

Post by maulinarmananda » Sun Mar 27, 2016 4:30 am

waw thank you :)

but can we play video on android fullscreen?

Post Reply

Return to “iOS Deployment”