I'm looking for the best way (code), cross platform, to determine if the
media a user selected for a player object is audio (only) or a video.
I am surprised there is not some inherent player property to get this
information. I am using an approach that looks at the formattedHeight
(with audio media that should just be the height of the controller), but
is there some better approach. What if, for some strange reason someone
loads a 2px high video? There isn't a way to get the controler height
exactly and I think it is slightly different between OSX and Windows
(and I have not checked Linux or any other platform)
This is our current code:
getProp mediaType -- returns whether a player is showing audio, video,
or none
put 40 into maxControllerHeight -- magic number
--
if word 1 of the name of the target is not "player" then return empty
--
if the filename of the target is empty OR there is no file (the
filename of the target) then return "none" -- player not loaded
if the formattedHeight of the target <= maxControllerHeight then
return "audio" else return "video"
end mediaType
However, the "40" figure bother me because it doesn't come from LiveCode
itself. What if with LC10, the Mothership revised the controller and its
now 41px high and the code breaks. Anyone have a better way?
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode