Embedded Video

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Tester2
Posts: 102
Joined: Wed May 18, 2011 7:02 pm

Embedded Video

Post by Tester2 » Thu Jun 09, 2011 3:49 pm

Allo amazing RunRev lords and ladies,

I know I saw someone's code on how to do this at one point, but I cannot for the life of me find/remember how to do it. :(

Help is greatly appreciated.

I am simply trying to have a video automatically play when I go to a card.

I know to put my video (Video.mov) into the File - Standalone Application Settings - Copy Files, but what is the code that goes into the Card's script?

I tried:

on openCard
play videoClip "Video.mov"
end openCard

...but to no avail.

Thanks bunches! :wink:

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Embedded Video

Post by Klaus » Thu Jun 09, 2011 3:59 pm

Hi Tester2 (is Tester1 your dad? :D ),

you need to supply the complete path, which is this in your case:
...
play (specialfolderpath("engine") & "/"Video.mov" )
...
NO keyword "videoclip", this is for desktop only!

Please read the "iOS Release Notes" for more info: LiveCode -> Menu -> Help


Best

Klaus

Tester2
Posts: 102
Joined: Wed May 18, 2011 7:02 pm

Re: Embedded Video

Post by Tester2 » Thu Jun 09, 2011 4:34 pm

Hey Klaus (is Santa your dad? :P ) lol

Nah, my dad doesn't do much with computers, besides using Word. :)

Allright, so I looked at the iOS Release Notes and tried the code you gave me so I have:

on openCard
set the showController of the templatePlayer to true
play video (specialfolderpath("engine") & "/Test.mov")
end openCard

This displays a player that plays for about 4 seconds, but it's small and there is no video or audio..just black (see attached Screenshot).

Does the Video need to be on my desktop?

Thanks bunches.
Attachments
Screen shot 2011-06-09 at 10.32.57 AM.png
Screenshot of Video that I am seeing
Screen shot 2011-06-09 at 10.32.57 AM.png (6.06 KiB) Viewed 5994 times

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Embedded Video

Post by Klaus » Thu Jun 09, 2011 5:09 pm

Hi Tester2,

no, Santa is the brother of my brother-in-law's sister's uncle (or so...) :D

Hm, since the iOS is case sensitive I guess that your movie is in fact named "test.mov" (no capitals!)
Is that true?

Edit:
The media engine on iOS IS obviously capable to "play" text files (like QucikTime), so since there is
no video file with that exact name, it "plays" the string "/Test.mov" as we can see on your screenshot 8)


Best

Klaus

Tester2
Posts: 102
Joined: Wed May 18, 2011 7:02 pm

Re: Embedded Video

Post by Tester2 » Thu Jun 09, 2011 5:32 pm

Hey Klaus,

The video is actually capitalized (Test.mov), but I have discovered something.

I ran this on the iPad simulator and the video played perfectly!! (full screen, video and audio..the whole sha-bang)

Hmmm...This is good, but confusing lol

Is this code only native to iOS so it won't display on the desktop in the LiveCode app itself, but only on simulators and mobile devices?

Thanks.

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Embedded Video

Post by Klaus » Thu Jun 09, 2011 5:52 pm

Hi Tester,

that syntax does not work in the desktop version!
specialfolderpath("engine") is mobile only!

You should use "if ... then...":
...
if the environment contains "mobile" then
## iOS syntax...
else
## Use "play videoclip" or better set up a player object to play your movie,
## since the "play" command only supports a limited number of movie formats!
end if
...

Best

Klaus

Tester2
Posts: 102
Joined: Wed May 18, 2011 7:02 pm

Re: Embedded Video

Post by Tester2 » Tue Jun 14, 2011 6:06 pm

Hey Klaus,

So...this was working fine (or so I thought) as I could now see my videos playing properly.

But here is where I hit a snag...

I assumed when you loaded a file (video, PDF, etc.) into the File - Standalone Application Settings - Copy Files, that this would essentially save that file into your app so you can reference it and play wherever.

However, if I take my LiveCode file onto a different machine and try to test it, the videos will not play, assumably because the file does not exist on that machine.

Just for clarification, does this mean that if you change machines with your LiveCode file, then you also need to copy the referenced file to that new machine and reload into the Standalone Settings in order for them to play properly?

Thanks bunches!

-Tester2

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Embedded Video

Post by Klaus » Wed Jun 15, 2011 5:18 pm

Hi Tester2,
Tester2 wrote:Hey Klaus,

So...this was working fine (or so I thought) as I could now see my videos playing properly.
Great!
Tester2 wrote:I assumed when you loaded a file (video, PDF, etc.) into the File - Standalone Application Settings - Copy Files, that this would essentially save that file into your app so you can reference it and play wherever.
Well, you said it, this are the STANDALONE settings!
That means the files will be copied into the resulting application bundle and nothing more! 8)
Tester2 wrote:However, if I take my LiveCode file onto a different machine and try to test it, the videos will not play, assumably because the file does not exist on that machine.
Exactly!
Tester2 wrote:Just for clarification, does this mean that if you change machines with your LiveCode file, then you also need to copy the referenced file to that new machine and reload into the Standalone Settings in order for them to play properly?
Yes! This is the case with all referenced media like videos, sounds and images.


Best

Klaus

Post Reply