Native video:load fails with media.selectVideo on Android

Hey Rob,

Thanks for your feedback.

Let me just confirm that I understand you correctly. What you’re saying is that currently it is not possible to select a video on Android and load it with native.newVideo? Even though this is currently working on Android prior to 4.4 and all iOS versions? This kind of makes media.selectVideo obsolete on Android because why would anyone bother opening anything other than the default gallery to simply play a video?

Our problem is that this feature was already working, and once a user updates, it becomes completely broken. It’s a bit extreme don’t you think?

If you have suggestions or pointers on where to start with Enterprise regarding that, please let us know. Also if the team can just get the already existing functionality up to date with Android 4.4 and above that would be grand.

P.S.: When we capture a video we are able to load it using native.newVideo. It’s media.selectVideo that is acting up. Some moments just can’t be recaptured.

Kind regards,
Shehab

You should be able to select a video and play it with native.newVideo().  What you can’t do is upload a video taken with media.captureVideo() to some service.  You can’t get a copy into your system.DocumentsDirectory.  However I would think that media.selectVideo().

I can’t look into this right now, but later today I’ll see if I can get an example working.

Rob

local function onComplete( event ) if event.completed then local video = native.newVideo( display.contentCenterX, display.contentCenterY, 640, 360 ) local function videoListener( event ) print( "Event phase: " .. event.phase ) if event.errorCode then native.showAlert( "Error!", event.errorMessage, { "OK" } ) end end -- load a remote video video:load( event.url, media.RemoteSource ) video:addEventListener( "video", videoListener ) -- play video video:play() end end if media.hasSource( media.savePhotosAlbum) then media.selectVideo( { listener=onComplete, mediaSource=media.savePhotosAlbum } ) else native.showAlert( "Corona", "This device does not have a photo library.", { "OK" } ) end

This code worked on my Google Nexus 7.

Rob