Video on Windows

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Stormy1
Posts: 31
Joined: Tue Jul 14, 2009 1:47 pm

Video on Windows

Post by Stormy1 » Mon Aug 17, 2009 10:13 am

Hi Everyone,

I have an issue with a cross platform program being developed on a Mac.

I know this has been covered already but I was wanting to find the best solution to getting video to play on Windows. The file type I'm using is mpeg1.

My program has 6 videos being called using the Media Player. I read the documentation and put the dontuseQT command before the videos come in. However, all I get is a black screen and nothing playing. Windows is obviously recognising a video file and putting it in the right place but just not playing it.

I don't want to use Quicktime Alternative simply because I don't want the people using the program to install anything if I can help it.

Would using the AVI format make any difference? I'm thinking not since mpeg1 is Windows friendly enough.

Is my only option to put a link for the user to download Quicktime for Windows?

Thanks

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

Post by Klaus » Mon Aug 17, 2009 10:45 am

Hi stromy1,

MPG1 should be playable even with the "play vc" command, at least that's stated in the docs!

Did you try to:
...
play vc "name of your clip.mpg" at 100,100
## ... at x,y = optional
...
?


Best

Klaus

Stormy1
Posts: 31
Joined: Tue Jul 14, 2009 1:47 pm

Post by Stormy1 » Mon Aug 17, 2009 10:51 am

Hi Klaus

No I'm not using that script. I'm using 'set the fileName of last player to..'

(I set the location of my mpg into the variable myPath)

set the fileName of last player to myPath
if not (there is a file myPath) then
beep
answer error "Can't find file" && myPath
else
if the platform is "Win32" then set the dontUseQT to true
if the platform is "Win64" then set the dontUseQT to true
end if

This works fine on a mac or Windows machine with Quicktime but not without Quicktime. Is this the wrong script?

Thanks

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

Post by Klaus » Mon Aug 17, 2009 11:08 am

Hi Stormy1,

you should "set the dontUseQT to true" as early as possible!
In the "preopenstack" handler preferrably, since once QT has been loaded (or any attempt to do so) you cannot get rid of it again until you restart your app!

So maybe this line "set the filename of player ..." in your script already loads QT and then you cannot go back some lines later!

Code: Select all

...
set the fileName of last player to myPath 
if not (there is a file myPath) then 
  beep 
  answer error "Can't find file" && myPath 
else 

## Too late, QT already loaded and "sticking"!
if the platform is "Win32" then set the dontUseQT to true 
...
Please try to set this in the "preopenstack" handler and see if that works.

BTW, you should check if a file exists BEFORE you set e.g. the filename of a player to that non existing file ;)

Code: Select all

...
if not (there is a file myPath) then 
  beep 
  answer error "Can't find file" && myPath 
else 
  set the fileName of last player to myPath
...
Best

Klaus

Stormy1
Posts: 31
Joined: Tue Jul 14, 2009 1:47 pm

Post by Stormy1 » Mon Aug 17, 2009 11:25 am

Hi Klaus

Thanks for your advice.

I set the preOpenStack handler but nothing changed. This is my script in the stack script:

on preOpenStack
set the loc of this stack to the screenLoc
if the platform is "Win32" then set the dontUseQT to true
if the platform is "Win64" then set the dontUseQT to true
pass preOpenStack
end preOpenStack

I still get the black screen as if something has loaded but nothing plays.

Should I use the 'play vc' command instead? Would that make a difference?

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

Post by Klaus » Mon Aug 17, 2009 11:37 am

Hi stormy1,
Stormy1 wrote:Hi Klaus
Thanks for your advice.
I set the preOpenStack handler but nothing changed. This is my script in the stack script:
on preOpenStack
set the loc of this stack to the screenLoc
if the platform is "Win32" then set the dontUseQT to true
if the platform is "Win64" then set the dontUseQT to true
pass preOpenStack
end preOpenStack
OK, looks good.
Stormy1 wrote:I still get the black screen as if something has loaded but nothing plays.
Should I use the 'play vc' command instead? Would that make a difference?
Sure, at least check if that makes a difference!
No idea otherwise.


Best

Klaus

Stormy1
Posts: 31
Joined: Tue Jul 14, 2009 1:47 pm

Post by Stormy1 » Mon Aug 17, 2009 11:57 am

Hi Klaus

Just to let you know the 'play videoClip' command worked a treat.
All plays now.

Thanks so much for your help on this. Appreciate it.

C

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

Post by Klaus » Mon Aug 17, 2009 12:00 pm

Hi C,

good news that it is working for you!

To be honest, I never got a "player" object working on Windows WITHOUT QuickTime :?
So I use "play vc..." or demand QT to be installed.


Best

Klaus

Stormy1
Posts: 31
Joined: Tue Jul 14, 2009 1:47 pm

Post by Stormy1 » Mon Aug 17, 2009 12:43 pm

Hi Klaus

Got myself a new problem now. How to stop the videos playing!!
At the moment, the user selects from a dropdown menu of 6 clips. Each time they select a new clip, it updates the player and plays the selected clip. Heres my script for one of the 6 videos:

on menuPick pItemName
switch pItemName
case "blah blah blah"
if the platform is "Win32" then set the dontUseQT to true
if the platform is "Win64" then set the dontUseQT to true
set the itemDel to slash
put item 1 to -2 of the effective filename of this stack into myPath
put "blah blah blah" after myPath
if not (there is a file myPath) then
beep
answer error "Can't find file" && myPath
else
play videoClip myPath at 449,317
end if
break

However, I now can't stop the videoClip or the player. In other words, when you make a new selection, it plays over the last clip and flickers. I have tried 'stop player "name of player", plus 'stop playing videoClip myPath' and neither work.

I tried to put a button on the page which simply had the 'stop player "name of player" and that didn't work either!

Am I missing something?

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Mon Aug 17, 2009 1:16 pm

Stormy1,

you can test whether the clip is still playing:

Code: Select all

on mouseUp
   if the movie is not done then
      play stop videoclip myPathToVideoClip
      -- play pause videoclip myPathToVideoClip
   end if
end mouseUp
if you issue a play pause command you can resume the movie or another play command.
If you issue a play stop command the movie dissapears.
regards
Bernd

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

Post by Klaus » Mon Aug 17, 2009 1:19 pm

Hi C.

"play vc ..." uses a slightly different sayntax :)

Code: Select all

...
on menuPick pItemName 
   play stop vc
   ## Wil stop any playing videoclip stated withj "play vc xyz"!
...
Check the Rev Dicitonary for "play" for more info about controlling audio- and video clips started with "play"!

play stop...
play pause...
play resume...
play step...

Best

Klaus

Stormy1
Posts: 31
Joined: Tue Jul 14, 2009 1:47 pm

Post by Stormy1 » Mon Aug 17, 2009 2:00 pm

Hi Klaus and bn

Thanks so much for your help. Got it working now!!

One thing I don't understand is if you can state 'play stop videoClip' and it stops whatever video is playing, why does 'play pause videoClip' not work in the same way?

Anyway, I'm getting there! Thanks again

Clive

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

Post by Klaus » Mon Aug 17, 2009 2:05 pm

Hi Clive,

sorry, no idea why "play pause vc" does not work without specifying the clip's name?

But glad you got it working :)


Best from germany

Klaus

Post Reply