Error trapping for a video file

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
lrieber
Posts: 40
Joined: Sat Sep 24, 2011 6:30 pm
Location: Athens, Georgia USA
Contact:

Error trapping for a video file

Post by lrieber » Thu Jul 10, 2014 3:51 pm

Hello,

I'm creating a video analysis tool application where the user chooses a video file to analyze for tagging and commenting. I've created a nice structure where the user can save as many analysis project as they wish, with each project pointing to a unique video file. All is working great.

But now I want to anticipate some error trapping, such as those times when the user inadvertently deletes or moves the video file from their hard drive after they have quit the LiveCode app. Then, when they launch the LiveCode app, I want my LiveCode to detect that the video file is missing followed by prompting the user to navigate to the video's new location.

I'm storing the path to the video file in a local variable called "varVideoFile" and here is the line that tells the video player where to find the file:
set the filename of player "Player" to varVideoFile

Again, this works great. But what if the video file is not there? Well, LiveCode just shows an empty player.

I know this is one way to do error trapping:

open file "MyFile"
if the result is not empty then
answer the result
exit to top
end if

But I don't want to open the video file, I just want to "look" and see if it is there. If it is (true), then I'll play the video as planned. If it isn't (false), I want to prompt the user to give me the new location.

So, my question is simply what is the code to just "look" to see if the file is there to return a result of true or false?

Thanks - Lloyd

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

Re: Error trapping for a video file

Post by Klaus » Thu Jul 10, 2014 3:59 pm

Hi Lloyd,

this one is pretty "cheap":
...
if there is a file varVideoFile then
## File present
....
Or
...
if there is NOT a file varVideoFile then
## File not present
...
:D


Best

Klaus

lrieber
Posts: 40
Joined: Sat Sep 24, 2011 6:30 pm
Location: Athens, Georgia USA
Contact:

Re: Error trapping for a video file

Post by lrieber » Thu Jul 10, 2014 4:18 pm

Thanks, Klaus.

I was assuming (and hoping) it would be something this simple. :)

Lloyd

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9842
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Error trapping for a video file

Post by FourthWorld » Wed Oct 22, 2014 3:26 am

Moderation note: thread restored to its original pre-spam state.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: Error trapping for a video file

Post by Klaus » Wed Oct 22, 2014 11:58 am

??? :shock:

Post Reply

Return to “Multimedia”