cordova-plugin-media3 1.1.24 → 1.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/android/Player.java +6 -7
package/package.json
CHANGED
package/src/android/Player.java
CHANGED
|
@@ -39,7 +39,6 @@ import androidx.annotation.NonNull;
|
|
|
39
39
|
import androidx.appcompat.widget.ContentFrameLayout;
|
|
40
40
|
|
|
41
41
|
// Media3 imports
|
|
42
|
-
import androidx.media3.common.Player;
|
|
43
42
|
import androidx.media3.common.*;
|
|
44
43
|
import androidx.media3.exoplayer.*;
|
|
45
44
|
import androidx.media3.exoplayer.source.*;
|
|
@@ -88,7 +87,7 @@ public class Player {
|
|
|
88
87
|
this.audioManager = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
|
|
89
88
|
}
|
|
90
89
|
|
|
91
|
-
private
|
|
90
|
+
private ExoPlayer.Listener playerEventListener = new ExoPlayer.Listener() {
|
|
92
91
|
@Override
|
|
93
92
|
public void onIsLoadingChanged(boolean isLoading) {
|
|
94
93
|
// JSONObject payload = Payload.loadingEvent(Player.this.exoPlayer, isLoading);
|
|
@@ -109,14 +108,14 @@ public class Player {
|
|
|
109
108
|
@Override
|
|
110
109
|
public void onPlaybackStateChanged(int playbackState) {
|
|
111
110
|
if (config.getShowBuffering()) {
|
|
112
|
-
LayoutProvider.setBufferingVisibility(exoView, activity, playbackState ==
|
|
111
|
+
LayoutProvider.setBufferingVisibility(exoView, activity, playbackState == ExoPlayer.STATE_BUFFERING);
|
|
113
112
|
}
|
|
114
113
|
JSONObject payload = Payload.stateEvent(Player.this.exoPlayer, playbackState, Player.this.controllerVisibility == View.VISIBLE);
|
|
115
114
|
new CallbackResponse(Player.this.callbackContext).send(PluginResult.Status.OK, payload, true);
|
|
116
115
|
}
|
|
117
116
|
|
|
118
117
|
@Override
|
|
119
|
-
public void onPositionDiscontinuity(@NonNull
|
|
118
|
+
public void onPositionDiscontinuity(@NonNull ExoPlayer.PositionInfo oldPosition, @NonNull ExoPlayer.PositionInfo newPosition, int reason) {
|
|
120
119
|
JSONObject payload = Payload.positionDiscontinuityEvent(Player.this.exoPlayer, reason);
|
|
121
120
|
new CallbackResponse(Player.this.callbackContext).send(PluginResult.Status.OK, payload, true);
|
|
122
121
|
}
|
|
@@ -232,8 +231,8 @@ public class Player {
|
|
|
232
231
|
public void createPlayer() {
|
|
233
232
|
Log.i(TAG, "Playing " + config.getUri());
|
|
234
233
|
|
|
235
|
-
// String mediaUrl = config.getUri()
|
|
236
|
-
// if (mediaUrl != null &&
|
|
234
|
+
// String mediaUrl = config.getUri(); // Your method to get the URL
|
|
235
|
+
// if (mediaUrl != null && URLUtil.isValidUrl(mediaUrl)) {
|
|
237
236
|
// Proceed with ExoPlayer setup using mediaUrl
|
|
238
237
|
if (config.useInlineView()) {
|
|
239
238
|
// Using a dialog doesn't work for us, as controls are drawn in HTML view (cordova ui)
|
|
@@ -606,7 +605,7 @@ public class Player {
|
|
|
606
605
|
|
|
607
606
|
public JSONObject getPlayerState() {
|
|
608
607
|
return Payload.stateEvent(exoPlayer,
|
|
609
|
-
null != exoPlayer ? exoPlayer.getPlaybackState() : Player.STATE_ENDED,
|
|
608
|
+
null != exoPlayer ? exoPlayer.getPlaybackState() : androidx.media3.common.Player.STATE_ENDED,
|
|
610
609
|
Player.this.controllerVisibility == View.VISIBLE);
|
|
611
610
|
}
|
|
612
611
|
|