Currently media.captureVideo seems to not follow its documentation.
Particularly the case of a cancelled video.
A case for this would be an Android user hitting the device back button after media.captureVideo has been called.
Documentation on https://docs.coronalabs.com/api/library/media/captureVideo.html says the following.
- event.url is a String which is the URL of the video. If the operation was cancelled, this value will be nil.
- event.completed will be true if the user captured a video; false if the user cancelled the video capture.
- event.duration will be the number of seconds of the video if the user captured a video; nil if the user cancelled the video capture or the value could not be obtained.
- event.fileSize will be the number of bytes of the user captured a video; nil if the user cancelled the video capture or the value could not be obtained.
However, after running through this several times, I have found the following.
- event.url is “” on video being cancelled
- event.completed is ALWAYS true when the listener gets called
Duration and fileSize behave as the documentation says.
For example, here is a table I was getting back from a failed video.
table: 0x650ce458 {
I/Corona (16204): [completed] => true
I/Corona (16204): [url] => “”
I/Corona (16204): [name] => “completion”
I/Corona (16204):
}
This bug was causing me a lot of problems, since all my ways to check for the video existing were failing.
Please update the documentation to reflect how these functions actually work.
For reference, I am using Version 2015.2634 (2015.5.13) on a Samsung Galaxy S3 running Android V 4.4.2