cordova-plugin-exoplayer icon indicating copy to clipboard operation
cordova-plugin-exoplayer copied to clipboard

Build Failing because of missing exoplayer dependency

Open netmikey opened this issue 2 years ago • 2 comments

When building a project with this plugin and cordova-android@11, the build is failing because of a missing dependency. Here's the error:

Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.google.android.exoplayer:exoplayer:2.6.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/android/exoplayer/exoplayer/2.6.1/exoplayer-2.6.1.pom
       - https://repo.maven.apache.org/maven2/com/google/android/exoplayer/exoplayer/2.6.1/exoplayer-2.6.1.pom
       - https://maven.google.com/com/google/android/exoplayer/exoplayer/2.6.1/exoplayer-2.6.1.pom
     Required by:
         project :app

And indeed, the Exoplayer 2.9.x Versions are present on none of these repositories. The first 2 don't have that package outright, and maven.google.com seems to have been cleaned up because if only shows way newer exoplayer versions starting with v2.13 (see here).

My guess is that this plugin will either have to update its exoplayer dependency to a newer version or add some repository to the Gradle build that holds the older versions.

Edit Also noticing that the Versions of this Plugin after 2.5.4 haven't been published to npm, so thats still the latest version on npm...?

netmikey avatar Sep 11 '22 11:09 netmikey

Hello, I have the same problem here, is there a solution for this problem?

fingunt avatar Sep 26 '22 18:09 fingunt

Same issue here 👍

bamboolix avatar Sep 27 '22 13:09 bamboolix

FYI: I forked this repository and migrated ExoPlayer as good as I could to the newest possible version that still works with the current Cordova versions (ExoPlayer 2.18.1 that is).

https://github.com/netmikey/cordova-plugin-exoplayer

Since this repository seems not to be maintained anymore, I'll switch to my own for now. I don't plan on doing any support though. @frontyard let me know if you'd be interested in a pull request for the ExoPlayer version upgrades.

netmikey avatar Mar 07 '23 07:03 netmikey

@netmikey I'd be happy to merge your changes if you send me a PR.

frontyard avatar Mar 08 '23 17:03 frontyard

Hi, @netmikey , thanks for the PR.

I tested it here, but when I open the video, the app closes.

My tests: Cordova: 11.0.0 Cordova-android: 9.1.0 / 11.0.0

guilhermelirio avatar Jun 29 '23 21:06 guilhermelirio

I see the same as @guilhermelirio . Get the following stack dump in logcat. I'm guessing the call to view.getPlayer() in getExoPlayerView() is returning null. But I need to get the debugger working before I can be sure.

08-09 16:27:14.574 11153 11153 D AndroidRuntime: Shutting down VM 08-09 16:27:14.577 11153 11153 E AndroidRuntime: FATAL EXCEPTION: main 08-09 16:27:14.577 11153 11153 E AndroidRuntime: Process: com.roku.web.trc, PID: 11153 08-09 16:27:14.577 11153 11153 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'android.os.Looper com.google.android.exoplayer2.Player.getApplicationLooper()' on a null object reference 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at com.google.android.exoplayer2.ForwardingPlayer.getApplicationLooper(ForwardingPlayer.java:48) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at com.google.android.exoplayer2.ui.StyledPlayerView.setPlayer(StyledPlayerView.java:525) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at co.frontyard.cordova.plugin.exoplayer.LayoutProvider.getExoPlayerView(LayoutProvider.java:55) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at co.frontyard.cordova.plugin.exoplayer.Player.createDialog(Player.java:218) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at co.frontyard.cordova.plugin.exoplayer.Player.createPlayer(Player.java:196) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at co.frontyard.cordova.plugin.exoplayer.Plugin$1.run(Plugin.java:46) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:938) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at android.os.Looper.loop(Looper.java:288) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7839) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 08-09 16:27:14.585 11153 11153 W om.roku.web.tr: Attempt to remove non-JNI local reference, dumping thread

riksagar avatar Aug 10 '23 23:08 riksagar

Hi, @netmikey , thanks for the PR.

I tested it here, but when I open the video, the app closes.

My tests: Cordova: 12.0.0 AndroidSDK 33

repotoolsapps avatar Aug 24 '23 18:08 repotoolsapps

I see the same as @guilhermelirio . Get the following stack dump in logcat. I'm guessing the call to view.getPlayer() in getExoPlayerView() is returning null. But I need to get the debugger working before I can be sure.

08-09 16:27:14.574 11153 11153 D AndroidRuntime: Shutting down VM 08-09 16:27:14.577 11153 11153 E AndroidRuntime: FATAL EXCEPTION: main 08-09 16:27:14.577 11153 11153 E AndroidRuntime: Process: com.roku.web.trc, PID: 11153 08-09 16:27:14.577 11153 11153 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'android.os.Looper com.google.android.exoplayer2.Player.getApplicationLooper()' on a null object reference 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at com.google.android.exoplayer2.ForwardingPlayer.getApplicationLooper(ForwardingPlayer.java:48) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at com.google.android.exoplayer2.ui.StyledPlayerView.setPlayer(StyledPlayerView.java:525) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at co.frontyard.cordova.plugin.exoplayer.LayoutProvider.getExoPlayerView(LayoutProvider.java:55) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at co.frontyard.cordova.plugin.exoplayer.Player.createDialog(Player.java:218) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at co.frontyard.cordova.plugin.exoplayer.Player.createPlayer(Player.java:196) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at co.frontyard.cordova.plugin.exoplayer.Plugin$1.run(Plugin.java:46) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:938) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at android.os.Looper.loop(Looper.java:288) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7839) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 08-09 16:27:14.577 11153 11153 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 08-09 16:27:14.585 11153 11153 W om.roku.web.tr: Attempt to remove non-JNI local reference, dumping thread

Have you been able to solve it?

repotoolsapps avatar Aug 24 '23 19:08 repotoolsapps

Yes and no! I added a null check around the view.setPlayer(new ForwardingPlayer(view.getPlayer()). After doing that, I can get playback to start. The crash was happening on an assert in ExoPlayer.

(I'm guessing @netmikey had the Assertion compiled out when he did the fix, so he wasn't getting the crash? [speculation!]).

So I get past the crash, content starts to play, and I can hear audio playing. However: I don't actually see the video - just a black screen. This could be related to our UI though. I'm investigating that now.

Feel free to take the fixes from my branch and let me know your experience:

  • https://github.com/riksagar/cordova-plugin-exoplayer/tree/bugfix/crash-at-player-load

riksagar avatar Aug 25 '23 16:08 riksagar

Now there is another problem, when configuring the array controller and trying to play the video the application also closes. thanks for your attention

var parameters = { url: url, userAgent: "", aspectRatio: 'FIT_SCREEN', // default is FIT_SCREEN hideTimeout: 5000, // Hide controls after this many milliseconds, default is 5 sec autoPlay: true, // When set to false stream will not automatically start seekTo: 10 * 60 * 60 * 1000, // Start playback 10 minutes into video specified in ms, default is 0 forwardTime: 30 * 1000, // Amount of time in ms to use when skipping forward, default is 1 min rewindTime: 30 * 1000, // Amount of time in ms to use when skipping backward, default is 1 min audioOnly: false, // Only play audio in the backgroud, default is false //subtitleUrl: 'http://url.to/subtitle.srt', // Optional subtitle url connectTimeout: 0, // http connect timeout in ms (default is 0) readTimeout: 0, // http read timeout in ms (default is 0) retryCount: 3, // Number of times datasource will retry the stream before giving up (default is 3) showBuffering: true, // When buffering, player will show indicator at the top of the screen, default is false controller: { // If this object is not present controller will not be visible streamImage: imagen, streamTitle: nombre.substring(0, 40), streamDescription: descripcion.substring(0, 65), hideProgress: false, // Hide entire progress timebar hidePosition: false, // If timebar is visible hide current position from it hideDuration: false, // If timebar is visible Hide stream duration from it controlIcons: { //'exo_rew': ' http://simpleicon.com/wp-content/uploads/play1-256x256.png', // Set to null to remove the button from the player //'exo_play': ' http://simpleicon.com/wp-content/uploads/play1-256x256.png', //'exo_pause': ' http://simpleicon.com/wp-content/uploads/play1-256x256.png', //'exo_ffwd': ' http://simpleicon.com/wp-content/uploads/play1-256x256.png', // Buttons not included in configuration will show up as default ExoPlayer buttons }, textColor: '#ffffffff', // These colors can be any valid Android color buttonsColor: '#ffffffff', // This example uses hex values including alpha (first byte) bufferingColor: '#ff0000ff' // Alpha of 'ff' makes it 100% opaque } }

El vie, 25 ago 2023 a las 18:39, riksagar @.***>) escribió:

Yes and no! I added a null check around the view.setPlayer(new ForwardingPlayer(view.getPlayer()). After doing that, I can get playback to start. The crash was happening on an assert in ExoPlayer.

(I'm guessing @netmikey https://github.com/netmikey had the Assertion compiled out when he did the fix, so he wasn't getting the crash? [speculation!]).

So I get past the crash, content starts to play, and I can hear audio playing. However: I don't actually see the video - just a black screen. This could be related to our UI though. I'm investigating that now.

Feel free to take the fixes from my branch and let me know your experience:

https://github.com/riksagar/cordova-plugin-exoplayer/tree/bugfix/crash-at-player-load

— Reply to this email directly, view it on GitHub https://github.com/frontyard/cordova-plugin-exoplayer/issues/105#issuecomment-1693635018, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMMM242K3ZHVEW7PNVDVH6TXXDIM3ANCNFSM6AAAAAAQJX6LOQ . You are receiving this because you commented.Message ID: @.***>

repotoolsapps avatar Aug 25 '23 18:08 repotoolsapps

Did you figure out your issue with the "array controller". Not sure what that is.

I wrote a test app with just my patched cordova-plugin-android. I was able to playback a plain MP4 file and a DASH stream (from dash-if site).

(Video and audio both played fine in both cases)

riksagar avatar Aug 28 '23 21:08 riksagar

Hey,

Has anyone figured out anything on this ? We have tried almost all available forks of this plugin but to no avail, this app keeps crashing while reaching the exoplayer related section.

Also @frontyard, we aren't able to add the newest version of the plugin, it still defaults to 2.5.4, and if we specify a fixed version it just doesn't recognize that version.

image

An update of the README is much needed

jamtechdev avatar Oct 04 '23 12:10 jamtechdev

Hey,

I made some additional changes to my crash-at-player-load branch. I've been testing it locally for a while with no issue.

I'll post a pull-request to @frontyard in the next few days, in addition to my test app.

You might try download the ZIP of my branch locally and cordova plugin add ... with that.

riksagar avatar Nov 01 '23 04:11 riksagar

Thank you for reporting, I am currently working on a libvlc plugin. It supports more video formats and so on. But I still have problems with App crashes, when the player is loading the video and I close the player or it is a slow url and I close the player. And the truth is that I can't move forward from there.

El El mié, 1 nov 2023 a las 5:06, riksagar @.***> escribió:

Hey,

I made some additional changes to my crash-at-player-load https://github.com/riksagar/cordova-plugin-exoplayer/tree/bugfix/crash-at-player-load branch. I've been testing it locally for a while with no issue.

I'll post a pull-request to @frontyard https://github.com/frontyard in the next few days, in addition to my test app.

You might try download the ZIP of my branch locally and cordova plugin add ... with that.

— Reply to this email directly, view it on GitHub https://github.com/frontyard/cordova-plugin-exoplayer/issues/105#issuecomment-1788375934, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMMM247O664NY6PIXBFCLITYCHDFZAVCNFSM6AAAAAAQJX6LOSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBYGM3TKOJTGQ . You are receiving this because you commented.Message ID: @.***>

repotoolsapps avatar Nov 01 '23 09:11 repotoolsapps

Can you share a stack trace from the crash?

libvlc would be interesting, but doesn't support DRM?

riksagar avatar Nov 01 '23 15:11 riksagar

We can merge changes from @netmikey and @riksagar back into original project. I just don't have enough time to test these changes, so if we do it as a major version change people can test without affecting their production code.

frontyard avatar Nov 01 '23 16:11 frontyard