Does Android apps play video with remote URL?

Sorry for asking this but I thought I read somewhere that the Android version of apps was having some trouble playing a video with a remote URL. Is this true?

I read the docs for playVideo and it listed the file types for iOS. What about Android? I need to play some of my own music videos in the app and want to call them from the server to play. I don’t want to use YouTube so hoping I can play them directly in the app with the device’s video player.

Thanks,

Warren

Sorry for asking again but does anyone know this? I tried it a few months ago and failed when trying to play a video remote with an Android app. I will try again today to see and report it. If anyone else has a comment about this then great.

Thanks,

Warren

Btw herer is the docs page for it. It shows the formats for iOS but what is supported for Android? Is mp4 supported?

Hi @WarrenW,

Can you post some code on how you’re attempting this? Which API are you using? "native.newVideo() or “media.playVideo()”?

Brent

Here is what I used just now and it gives me a message “Can’t play thi video”.

- Your code here local widget = require("widget") local function btnConnectButtonEvent( event ) if ("ended" == event.phase ) then media.playVideo( "http://www.printyourfunlabels.com/funlabels.mp4", true, onComplete ) end end btnConnect = widget.newButton { width = 275, height = 75, defaultFile = "images/btnContinue4.png", overFile = "images/btnContinue4.png", label = "", onEvent = btnConnectButtonEvent } btnConnect.anchorX = 0 btnConnect.anchorY = 0 btnConnect.y = 300 btnConnect.x = 200

I then tried this and same error:

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( "http://www.printyourfunlabels.com/funlabels.mp4", media.RemoteSource ) -- Add video event listener video:addEventListener( "video", videoListener ) -- Play video video:play()

Can you play the “BigBuckBunny” video that’s shown in the documentation sample? If so, then there’s likely a problem with the video you’re trying to show, not with the Corona API.

Best regards,

Brent

I put that video in there and I still get the message Can’t play this video. Here is the build page showing I have internet permission for Android.

-- -- For more information on build.settings see the Corona SDK Build Guide at: -- http://docs.coronalabs.com/guide/distribution/buildSettings/index.html -- settings = { orientation = { -- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight default = "portrait", supported = { "portrait", } }, excludeFiles = { -- Include only the necessary icon files on each platform iphone = { "Icon-\*dpi.png", }, android = { "Icon.png", "Icon-Small-\*.png", "Icon\*@2x.png", }, }, -- -- iOS Section -- iphone = { plist = { UIStatusBarHidden = false, UIPrerenderedIcon = true, -- set to false for "shine" overlay --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-167.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, --[[-- iOS app URL schemes: CFBundleURLTypes = { { CFBundleURLSchemes = { "fbXXXXXXXXX", -- replace XXXXXXXXX with your Facebook appId } } } --]] } }, -- -- Android Section -- androidPermissions = { "android.permission.INTERNET", "android.permission.WRITE\_EXTERNAL\_STORAGE", }, }

Hi Warren,

Before we proceed, try running one of our sample video projects on the same phone. 

SampleCode > Media > StreamingVideo

SampleCode > Media > StreamingVideoPort

You’ve been a Corona user long enough that I’m sure you know these are located in your local Corona application folder. :slight_smile:

Brent

Thanks for the suggestion. I have the latest version of Corona installed on Windows and then compiled the sample StreamingVideo. I ran it and the first screen came up which said to tap to plav the video. I thought it was about to play but I got the popup message again saying that it can’t play the video.

I am using a Samsung Galaxy S6 Edge. Byw, the video player on my phone comes up with the pause button and the line showing  where it is during play and then fails there. So I’m wondering if it is something with my phone then.

Sounds like something with the phone, honestly. Do you have some permission that would be denying/blocking video? Are you using some uncommon video player app?

Brent

Sorry for asking again but does anyone know this? I tried it a few months ago and failed when trying to play a video remote with an Android app. I will try again today to see and report it. If anyone else has a comment about this then great.

Thanks,

Warren

Btw herer is the docs page for it. It shows the formats for iOS but what is supported for Android? Is mp4 supported?

Hi @WarrenW,

Can you post some code on how you’re attempting this? Which API are you using? "native.newVideo() or “media.playVideo()”?

Brent

Here is what I used just now and it gives me a message “Can’t play thi video”.

- Your code here local widget = require("widget") local function btnConnectButtonEvent( event ) if ("ended" == event.phase ) then media.playVideo( "http://www.printyourfunlabels.com/funlabels.mp4", true, onComplete ) end end btnConnect = widget.newButton { width = 275, height = 75, defaultFile = "images/btnContinue4.png", overFile = "images/btnContinue4.png", label = "", onEvent = btnConnectButtonEvent } btnConnect.anchorX = 0 btnConnect.anchorY = 0 btnConnect.y = 300 btnConnect.x = 200

I then tried this and same error:

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( "http://www.printyourfunlabels.com/funlabels.mp4", media.RemoteSource ) -- Add video event listener video:addEventListener( "video", videoListener ) -- Play video video:play()

Can you play the “BigBuckBunny” video that’s shown in the documentation sample? If so, then there’s likely a problem with the video you’re trying to show, not with the Corona API.

Best regards,

Brent

I put that video in there and I still get the message Can’t play this video. Here is the build page showing I have internet permission for Android.

-- -- For more information on build.settings see the Corona SDK Build Guide at: -- http://docs.coronalabs.com/guide/distribution/buildSettings/index.html -- settings = { orientation = { -- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight default = "portrait", supported = { "portrait", } }, excludeFiles = { -- Include only the necessary icon files on each platform iphone = { "Icon-\*dpi.png", }, android = { "Icon.png", "Icon-Small-\*.png", "Icon\*@2x.png", }, }, -- -- iOS Section -- iphone = { plist = { UIStatusBarHidden = false, UIPrerenderedIcon = true, -- set to false for "shine" overlay --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-167.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, --[[-- iOS app URL schemes: CFBundleURLTypes = { { CFBundleURLSchemes = { "fbXXXXXXXXX", -- replace XXXXXXXXX with your Facebook appId } } } --]] } }, -- -- Android Section -- androidPermissions = { "android.permission.INTERNET", "android.permission.WRITE\_EXTERNAL\_STORAGE", }, }

Hi Warren,

Before we proceed, try running one of our sample video projects on the same phone. 

SampleCode > Media > StreamingVideo

SampleCode > Media > StreamingVideoPort

You’ve been a Corona user long enough that I’m sure you know these are located in your local Corona application folder. :slight_smile:

Brent

Thanks for the suggestion. I have the latest version of Corona installed on Windows and then compiled the sample StreamingVideo. I ran it and the first screen came up which said to tap to plav the video. I thought it was about to play but I got the popup message again saying that it can’t play the video.

I am using a Samsung Galaxy S6 Edge. Byw, the video player on my phone comes up with the pause button and the line showing  where it is during play and then fails there. So I’m wondering if it is something with my phone then.

Sounds like something with the phone, honestly. Do you have some permission that would be denying/blocking video? Are you using some uncommon video player app?

Brent