setting the rec of a player object

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
reelstuff
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 254
Joined: Mon Apr 16, 2007 12:06 am
Contact:

setting the rec of a player object

Post by reelstuff » Tue Feb 23, 2010 2:50 am

I have been experimenting with a player object, setting the source from the available media in a folder.

Code: Select all

command setupsource
   get fld "playersource"
   put it into sourceVar
   ## set the filename of player "Player1" to sourceVar
  ## find a way to get the rec of the video 
   ##set the rec of player1 to tRec
   send mouseUp to control "List Sorted Files"
end setupsource
I managed to get the object to switch the media, from video to mp3 and back again but I have an issue
with video that is of a different size than the first player object, so I tried to set the rec of the player object, which failed.
any thoughts or suggestions, are always very welcomed.

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

Re: setting the rec of a player object

Post by Klaus » Tue Feb 23, 2010 9:17 am

Hi reelstuff,

after setting the filename of a player you can query "the formattedheigth of player x" and "the formattedwidth of player x".
Then you can calculate the neccessary rect, but keep the height of the controller in mind (16 pixels if I remember right)!
If it is a sound file like MP3 then these values are 0 (zero).

Hope that helps.


Best

Klaus

Post Reply