native.newVideo not working anymoe

@XeduR

This code was working perfectly, and suddenly it is not working! thia is from Solar2d’s website … my code is similar also not working

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 ( "https://coronalabs.com/video/bbb/BigBuckBunny_640x360.m4v" , media.RemoteSource )

-- Add video event listener

video:addEventListener( "video" , videoListener )

-- Play video

video:play()

I copied the snippet you posted into a main.lua file, and it worked as expected. I tried it on Build 3692 and 3677- both without issue. Could you be having a firewall issue or similar on your computer?

This code does not run at all on computers (Windows Desktop simulator) … it only runs on mobile phones
Try an android phone and see

My apologies- native.newVideo does run from the Mac version of the simulator.

So, I built and ran something with the native.newVideo snippet from the docs and found that it fails on my test device running Android version 12, but functions as expected on an older device running Android version 8. Similarly, my newer Fire tablet, running Fire OS 7 (based on Android 9), would not run the video, but an older Kindle running Fire OS 5 (based on Android 5) played the video.

this is for local videos, the problem is with remote videos!!

I’m sorry, but this seems strange.
According to the documentation newVideo(), it states that newVideo is not available on Windows.

May I ask you to provide additional information about it should or should not work like what? And specific Solar2D version will help to us.

@kakula brought up Windows to counter my question about if it might be a firewall issue. They already know that it doesn’t work on Windows. (I didn’t know that because I was testing it in the simulator on a Mac.)

Per my follow-up post, I did a little experiment and discovered that native.newVideo does not work on device for Android devices using newer versions of the OS, but does work on devices running older versions of the OS.

Since native.newVideo runs on my Android 8 device (API level 27) but does not run on my newer Kindle Fire (API level 28) one would speculate that something changed on the Android side. Perhaps a permission beyond just INTERNET is now required. :man_shrugging:

As to your questions: What should happen is that, after a brief buffering period, video should start playing. What should not happen is nothing for ten seconds followed by a popup saying “The video cannot be played” and event phase: failed and event phase: ended showing up in logcat. I built my test app using 3677.

If someone would like to perform a similar test using the latest build, I would encourage them to do so.

If someone has success using native.newVideoon a device running API level 28 or higher, it might be helpful if they shared their build settings.

1 Like

I mean we can add more information to help solve this problem.
I thought it had something with PR #512, but I was wrong, after tested 3685 and 3686 (PR just between those versions) on Android 13, Sample/Media/NewVideo neither work on those version, it just show Unable to play.

Was this resolved ? Doesn’t seem to be working still

edit: this works fine, you just have to use https now AND get external write permission in android

This seems like a different issue since it relates to the size of the file not loading video from an external site. I’d suggest opening a new thread.