Including libraries in standalone?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 346
- Joined: Mon Mar 01, 2010 7:13 pm
- Location: London, UK
- Contact:
Including libraries in standalone?
I've poked into the Video Capture example stack and want to make something that grabs a still image, uploads it to a predetermined FTP location, then launches the URL in a browser.
I have this working fine in LiveCode, but I just can't figure out how to get it functioning in a standalone. In the Standalone Application Settings window I've selected the appropriate lines in the Script Libraries (Internet and Video Grabber) and built a standalone, BUT when it's an app it doesn't grab a new image *or* upload anything.
It seems clear that it's a problem to do with including the libraries. I'm using the script in an openCard handler, which can also be triggered from a button after the stack/app opens. Here's the script (with all FTP details anonymised here, of course). Any thoughts?
(LiveCode Community rc 1, Mac OS X 10.8.3)
- Keith
on openCard
local videoImageData
put empty into videoimagedata
revVideoFrameImage "640", "480","videoimagedata"
set the imagedata of image "videoimage" to videoimagedata
put "~/Desktop/test.jpg" into tFileForUpload
put "test.jpg" into tFileName
export image "videoImage" to file tFileForUpload as jpeg
put "ftp://" & USERNAME & ":" & PASSWORD & "@" & FTP-URL & tFileName into tDestination
libURLftpUploadFile tFileForUpload, tDestination, "uploadComplete"
end openCard
on uploadComplete
launch url "http://DOMAIN.com/test.jpg"
end uploadComplete
I have this working fine in LiveCode, but I just can't figure out how to get it functioning in a standalone. In the Standalone Application Settings window I've selected the appropriate lines in the Script Libraries (Internet and Video Grabber) and built a standalone, BUT when it's an app it doesn't grab a new image *or* upload anything.
It seems clear that it's a problem to do with including the libraries. I'm using the script in an openCard handler, which can also be triggered from a button after the stack/app opens. Here's the script (with all FTP details anonymised here, of course). Any thoughts?
(LiveCode Community rc 1, Mac OS X 10.8.3)
- Keith
on openCard
local videoImageData
put empty into videoimagedata
revVideoFrameImage "640", "480","videoimagedata"
set the imagedata of image "videoimage" to videoimagedata
put "~/Desktop/test.jpg" into tFileForUpload
put "test.jpg" into tFileName
export image "videoImage" to file tFileForUpload as jpeg
put "ftp://" & USERNAME & ":" & PASSWORD & "@" & FTP-URL & tFileName into tDestination
libURLftpUploadFile tFileForUpload, tDestination, "uploadComplete"
end openCard
on uploadComplete
launch url "http://DOMAIN.com/test.jpg"
end uploadComplete
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
Re: Including libraries in standalone?
Hi Keith,
checking the libs in the standalone builder should work!
Did oyu check in the standalone app if the libraries really got copied by the standalone builder?
Righ-click on the APP -> Show contents
Your standalone.app -> Contents -> MacOS -> externals (or something like this...)
On the other hand, I do not see any "revInitializeVideoGrabber" handler in your script(s)?
Best
Klaus
checking the libs in the standalone builder should work!
Did oyu check in the standalone app if the libraries really got copied by the standalone builder?
Righ-click on the APP -> Show contents
Your standalone.app -> Contents -> MacOS -> externals (or something like this...)
On the other hand, I do not see any "revInitializeVideoGrabber" handler in your script(s)?
Best
Klaus
Re: Including libraries in standalone?
I have run into situations where libraries don't seem to be fully loaded when the openStack scripts run. Try using send in time to give it a short delay. I'm not sure it will work in this situation, but it might be worth a try.
-
- VIP Livecode Opensource Backer
- Posts: 346
- Joined: Mon Mar 01, 2010 7:13 pm
- Location: London, UK
- Contact:
Re: Including libraries in standalone?
Thanks Klaus – I seem to have forgotten a little more than I realised! It's been quite some time since I used Rev... I mean LiveCode.
Unfortunately, I'm still stuck. After some efforts, I took a copy of the original Video Capture example stack, set its Standalone Application Settings to include the Video Grabber library, and made that into a Mac OS application. This captures an image when run as a stack from within LC, but it doesn't when run as a standalone app. And yes, the application bundle does contain the revvideograbber.bundle external.
Am I right in assuming that the example project, when built as an app with the Video Grabber library included, should grab an image from my MacBook Pro's built-in camera, just as it does when run as a stack? Any thoughts?
Keith
Unfortunately, I'm still stuck. After some efforts, I took a copy of the original Video Capture example stack, set its Standalone Application Settings to include the Video Grabber library, and made that into a Mac OS application. This captures an image when run as a stack from within LC, but it doesn't when run as a standalone app. And yes, the application bundle does contain the revvideograbber.bundle external.
Am I right in assuming that the example project, when built as an app with the Video Grabber library included, should grab an image from my MacBook Pro's built-in camera, just as it does when run as a stack? Any thoughts?
Keith
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
Re: Including libraries in standalone?
Hi Keith,
if the card with the "opencqrd" script is the first card in your standalone
then maybe the way Livecode loads its libraries and externals in a standalone
is the problem and the libs are not yet loaded at that point.
Try to give the "loading" a little more time to finish:
At least worht a try
Best
Klaus
if the card with the "opencqrd" script is the first card in your standalone
then maybe the way Livecode loads its libraries and externals in a standalone
is the problem and the libs are not yet loaded at that point.
Try to give the "loading" a little more time to finish:
Code: Select all
on openCard
send "doit" to me in 1
## = 1/60 second should do
end openCard
on doit
local videoImageData
put empty into videoimagedata
revVideoFrameImage "640", "480","videoimagedata"
set the imagedata of image "videoimage" to videoimagedata
put "~/Desktop/test.jpg" into tFileForUpload
put "test.jpg" into tFileName
export image "videoImage" to file tFileForUpload as jpeg
put "ftp://" & USERNAME & ":" & PASSWORD & "@" & FTP-URL & tFileName into tDestination
libURLftpUploadFile tFileForUpload, tDestination, "uploadComplete"
end doit
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 346
- Joined: Mon Mar 01, 2010 7:13 pm
- Location: London, UK
- Contact:
Re: Including libraries in standalone?
Thanks again Klaus! Just to make sure, I put 'in 60' as the send delay. It's starting to send me spinning in circles: it seems to work, but not consistently. Which means I need to track down what the variable is that's causing this. Variable in the non-code sense of course...
[muffled "aargh!"]
k
[muffled "aargh!"]
k
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
Re: Including libraries in standalone?
Hi Keith,
another thing is that the current "revVideoGrabber..." implementation is not working reliably in my opinion.
Looks like oyu are on the Mac, then you could try the new video grabber commands and functions.
Check the "Release Notes" (Menu: Help) and look for: Mac – revCapture video capture library (4.6.1 – experimental )...
Best
Klaus
another thing is that the current "revVideoGrabber..." implementation is not working reliably in my opinion.
Looks like oyu are on the Mac, then you could try the new video grabber commands and functions.
Check the "Release Notes" (Menu: Help) and look for: Mac – revCapture video capture library (4.6.1 – experimental )...
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 346
- Joined: Mon Mar 01, 2010 7:13 pm
- Location: London, UK
- Contact:
Re: Including libraries in standalone?
Hmm. I have the release notes PDF open - "LiveCode 6.1.0-rc-1 Release Notes 6/24/13" - but there's nothing in here about video. I'm now wondering whether I should install 6.0.x instead of the RC1 build of 6.1.
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
Re: Including libraries in standalone?
Oh yes, this is not in the newest release notes?
Will add the 6.0.1 Release notes as an attachment here.
EDIT: PDF not allowed as attachment, hmmm...
Send me a mail and I will send you the PDF: klaus AT major-k.de
Will add the 6.0.1 Release notes as an attachment here.
EDIT: PDF not allowed as attachment, hmmm...
Send me a mail and I will send you the PDF: klaus AT major-k.de
-
- VIP Livecode Opensource Backer
- Posts: 346
- Joined: Mon Mar 01, 2010 7:13 pm
- Location: London, UK
- Contact:
Re: Including libraries in standalone?
So many oddities...
When I open my stack I sometimes get a 'can't find handler' error, pointing at the libURLftpUploadFile line:
libURLftpUploadFile tFileForUpload, tDestination, "uploadComplete"
But other times it runs fine with no error, and uploads.
The difference appears to be based on whether or not I have revCloseVideoGrabber within the script that also runs the upload. It doesn't matter whether revCloseVideoGrabber is before the FTP line or after, or if it's put in another handler and called. When it's there in the script or the script path, the error gets thrown. When it's not, the error doesn't happen.
...bug?
(At least there seems to be no difference between LC 6.0.2 and 6.1 rc1.)
k
When I open my stack I sometimes get a 'can't find handler' error, pointing at the libURLftpUploadFile line:
libURLftpUploadFile tFileForUpload, tDestination, "uploadComplete"
But other times it runs fine with no error, and uploads.
The difference appears to be based on whether or not I have revCloseVideoGrabber within the script that also runs the upload. It doesn't matter whether revCloseVideoGrabber is before the FTP line or after, or if it's put in another handler and called. When it's there in the script or the script path, the error gets thrown. When it's not, the error doesn't happen.
...bug?
(At least there seems to be no difference between LC 6.0.2 and 6.1 rc1.)
k
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist