can't play the video on my android device

I ran the following code on my HUAWEY P30 Lite.

local onComplete = function( event )
    print( "video session ended" )
 end
media.playVideo( "https://coronalabs.com/video/bbb/BigBuckBunny_640x360.m4v", media.RemoteSource, true, onComplete)

However, the video did not play, an indicator was displayed, and then the message “This video cannot be played” was displayed.

Please let me know if you know the solution.

1 Like

・device log

2022-04-28 21:49:13.502 822-5901/? E/NuCachedSource2: source returned error -1, 0 retries left
2022-04-28 21:49:13.520 819-17569/? E/AMRExtractor: read header failed!
2022-04-28 21:49:13.535 822-5900/? E/GenericSource: initFromDataSource, cannot create extractor!
2022-04-28 21:49:13.535 822-5900/? E/GenericSource: Failed to init from data source!
2022-04-28 21:49:13.538 5774-5800/? D/MediaPlayerNative: Message: MEDIA_ERROR(100), ext1=MEDIA_ERROR_UNKNOWN(1), ext2=0x80000000
2022-04-28 21:49:13.538 5774-5800/? E/MediaPlayerNative: error (1, -2147483648)
2022-04-28 21:49:13.538 5774-5800/? D/MediaPlayerNative: [notify] : [1170] callback app listenerNotNull=1, send=1
2022-04-28 21:49:13.538 5774-5774/? E/MediaPlayer: Error (1,-2147483648)
2022-04-28 21:49:13.539 5774-5774/? D/VideoView: Error: 1,-2147483648

“AMR Extractor” is output in the log.
This is an unused audio codec.
It may have been accessed as AMR codec data and failed.
I’m not sure why I think it’s an AMR codec and I’m trying to read it.

Can “media.playVideo ()” only play local files on Android devices?

Hey!

Have you tried running one of the media sample projects on your Android device to see if it has the same issues?

I know Google/Android have began to enforce a lot stricter networking requirements, but there should be no issues with playing files like that.

Yes. I tried it.
I built the sample code “VideoPlayer” and ran it on an Android 10 device.
However, the video did not play.

If I had the file on my device, I was able to play the video.
I don’t understand why the files on the server can’t be played.

I can’t think of any other solution, so I work around the problem this way.

        local path
        local params = {}
        local function networkListener( event )
            local function onComplete()
                os.remove( path )
            end
            path = system.pathForFile( "temp.m4v", system.TemporaryDirectory )
            media.playVideo( path, true, onComplete)
        end
            
        network.download(
            "https://coronalabs.com/video/bbb/BigBuckBunny_640x360.m4v",
            "GET",
            networkListener,
            params,
            "temp.m4v",
            system.TemporaryDirectory
        )

PS
Two years ago, an app built on 3619 played a video.
When I build it with 3665, it can no longer be played.