The right way to email a video

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

The right way to email a video

Post by Mag » Wed Jun 19, 2013 12:34 am

Hi,

which is the best way to send a video via email? I'm trying this but the video file is not attached to the composed email...

mobileComposeMail "My subject", , , , "My body", videoPath

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: The right way to email a video

Post by Mark » Wed Jun 19, 2013 9:36 am

Hi,

There are (at least) two ways to send an attachment. The first is to attach the binary data directly.

Code: Select all

put url ("binfile:" & myVideoPath) into myData["data"]
put "video/mp4" into myData["type"]
put "File Name" into myData["name"]
mobileComposeMail "My subject", , , , "My body", myData
The second way is to provide a file path.

Code: Select all

put myVideoPath into myData["file"]
put "video/mp4" into myData["type"]
put "File Name" into myData["name"]
mobileComposeMail "My subject", , , , "My body", myData
In both cases, the attachment parameter needs to be an array.

The mobileComposeMail entry in the dictionary contains some very good examples and is worth reading.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: The right way to email a video

Post by Mag » Thu Jun 20, 2013 4:43 pm

Thank you so much Mark, this make all clear.

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: The right way to email a video

Post by Mag » Sat Jan 18, 2014 9:52 pm

Is the first way adapt also to send images? I mean, could I send an image without have a file?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: The right way to email a video

Post by Mark » Sat Jan 18, 2014 10:23 pm

Hi,

Yes, that should work.

I don't know if this is relevant to you, but this won't work on Android due to a bug. It works on iOS only.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: The right way to email a video

Post by Mag » Sat Jan 18, 2014 10:30 pm

Mark wrote:Hi,

Yes, that should work.

I don't know if this is relevant to you, but this won't work on Android due to a bug. It works on iOS only.

Kind regards,

Mark

Oh, yes, it's very relevant, it was just because I could not send attachments with Android I wanted to know this method. So now I know that there is no hope. Thanks for telling me.

PS
Just to understand, to send an image, what I should write instead of

put url ("BinFile:" & myVideoPath) into myData ["date"]?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: The right way to email a video

Post by Mark » Sat Jan 18, 2014 11:00 pm

Hi,

If you want to send an image that is on the card, you can use

Code: Select all

put the text of img 1 into myData["data"]
and if you want to send an image that is on disk, you can use a file path in the same way as with videos. Keep in mind that the mime type is different. For PNG files for example:

Code: Select all

put url ("binfile:" & myPicturePath) into myData["data"]
put "image/png" into myData["type"]
put "File Name" into myData["name"]
mobileComposeMail "My subject", , , , "My body", myData
If you want to include an image from the stack rather than from a file and you don't know which format the image is in, you can export it first:

Code: Select all

export snapshot from img 1 to myPictureData as PNG
put myPictureData into myData["data"]
put empty into myPictureData
put "image/png" into myData["type"]
put "File Name" into myData["name"]
mobileComposeMail "My subject", , , , "My body", myData
Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: The right way to email a video

Post by Mag » Sun Jan 19, 2014 1:55 am

Thank you so much Mark!

Post Reply