cordova-plugin-media3 1.1.21 → 1.1.24

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-media3",
3
- "version": "1.1.021",
3
+ "version": "1.1.024",
4
4
  "description": "Media player for Cordova using Google's media3 ExoPlayer framework",
5
5
  "cordova": {
6
6
  "id": "cordova-plugin-media3",
@@ -49,13 +49,13 @@ public class Payload {
49
49
  case Player.STATE_IDLE:
50
50
  state = "STATE_IDLE";
51
51
  break;
52
- case androidx.media3.common.Player.STATE_BUFFERING:
52
+ case Player.STATE_BUFFERING:
53
53
  state = "STATE_BUFFERING";
54
54
  break;
55
- case androidx.media3.common.Player.STATE_READY:
55
+ case Player.STATE_READY:
56
56
  state = "STATE_READY";
57
57
  break;
58
- case androidx.media3.common.Player.STATE_ENDED:
58
+ case Player.STATE_ENDED:
59
59
  state = "STATE_ENDED";
60
60
  break;
61
61
  }
@@ -39,6 +39,7 @@ import androidx.annotation.NonNull;
39
39
  import androidx.appcompat.widget.ContentFrameLayout;
40
40
 
41
41
  // Media3 imports
42
+ import androidx.media3.common.Player;
42
43
  import androidx.media3.common.*;
43
44
  import androidx.media3.exoplayer.*;
44
45
  import androidx.media3.exoplayer.source.*;
@@ -87,7 +88,7 @@ public class Player {
87
88
  this.audioManager = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
88
89
  }
89
90
 
90
- private androidx.media3.common.Player.Listener playerEventListener = new androidx.media3.common.Player.Listener() {
91
+ private Player.Listener playerEventListener = new Player.Listener() {
91
92
  @Override
92
93
  public void onIsLoadingChanged(boolean isLoading) {
93
94
  // JSONObject payload = Payload.loadingEvent(Player.this.exoPlayer, isLoading);
@@ -108,14 +109,14 @@ public class Player {
108
109
  @Override
109
110
  public void onPlaybackStateChanged(int playbackState) {
110
111
  if (config.getShowBuffering()) {
111
- LayoutProvider.setBufferingVisibility(exoView, activity, playbackState == androidx.media3.common.Player.STATE_BUFFERING);
112
+ LayoutProvider.setBufferingVisibility(exoView, activity, playbackState == Player.STATE_BUFFERING);
112
113
  }
113
114
  JSONObject payload = Payload.stateEvent(Player.this.exoPlayer, playbackState, Player.this.controllerVisibility == View.VISIBLE);
114
115
  new CallbackResponse(Player.this.callbackContext).send(PluginResult.Status.OK, payload, true);
115
116
  }
116
117
 
117
118
  @Override
118
- public void onPositionDiscontinuity(@NonNull androidx.media3.common.Player.PositionInfo oldPosition, @NonNull androidx.media3.common.Player.PositionInfo newPosition, int reason) {
119
+ public void onPositionDiscontinuity(@NonNull Player.PositionInfo oldPosition, @NonNull Player.PositionInfo newPosition, int reason) {
119
120
  JSONObject payload = Payload.positionDiscontinuityEvent(Player.this.exoPlayer, reason);
120
121
  new CallbackResponse(Player.this.callbackContext).send(PluginResult.Status.OK, payload, true);
121
122
  }
@@ -231,8 +232,8 @@ public class Player {
231
232
  public void createPlayer() {
232
233
  Log.i(TAG, "Playing " + config.getUri());
233
234
 
234
- Uri mediaUrl = config.getUri(); // Your method to get the URL
235
- if (mediaUrl != null && android.webkit.URLUtil.isValidUrl(mediaUrl)) {
235
+ // String mediaUrl = config.getUri().toString(); // Your method to get the URL
236
+ // if (mediaUrl != null && android.webkit.URLUtil.isValidUrl(mediaUrl)) {
236
237
  // Proceed with ExoPlayer setup using mediaUrl
237
238
  if (config.useInlineView()) {
238
239
  // Using a dialog doesn't work for us, as controls are drawn in HTML view (cordova ui)
@@ -247,11 +248,11 @@ public class Player {
247
248
  if (config.useInlineView()) {
248
249
  setController(config.getController());
249
250
  }
250
- } else {
251
- // Handle invalid or null URL: e.g., show an error message, log the issue, or use a placeholder.
252
- Log.e("ExoPlayerDebug", "Invalid media URL: " + mediaUrl);
253
- sendError("Invalid media URL: " + mediaUrl);
254
- }
251
+ // } else {
252
+ // // Handle invalid or null URL: e.g., show an error message, log the issue, or use a placeholder.
253
+ // Log.e("ExoPlayerDebug", "Invalid media URL: " + mediaUrl);
254
+ // sendError("Invalid media URL: " + mediaUrl);
255
+ // }
255
256
  }
256
257
 
257
258
  public void createDialog() {
@@ -605,7 +606,7 @@ public class Player {
605
606
 
606
607
  public JSONObject getPlayerState() {
607
608
  return Payload.stateEvent(exoPlayer,
608
- null != exoPlayer ? exoPlayer.getPlaybackState() : androidx.media3.common.Player.STATE_ENDED,
609
+ null != exoPlayer ? exoPlayer.getPlaybackState() : Player.STATE_ENDED,
609
610
  Player.this.controllerVisibility == View.VISIBLE);
610
611
  }
611
612