cordova-plugin-media3 1.1.19 → 1.1.20

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.019",
3
+ "version": "1.1.020",
4
4
  "description": "Media player for Cordova using Google's media3 ExoPlayer framework",
5
5
  "cordova": {
6
6
  "id": "cordova-plugin-media3",
@@ -25,6 +25,7 @@ package co.frontyard.cordova.plugin.exoplayer;
25
25
 
26
26
  import android.util.Log;
27
27
  import android.view.*;
28
+ import androidx.media3.common.Player;
28
29
  import androidx.media3.common.*;
29
30
  import androidx.media3.exoplayer.*;
30
31
  import androidx.media3.exoplayer.trackselection.*;
@@ -231,18 +231,26 @@ public class Player {
231
231
  public void createPlayer() {
232
232
  Log.i(TAG, "Playing " + config.getUri());
233
233
 
234
- if (config.useInlineView()) {
235
- // Using a dialog doesn't work for us, as controls are drawn in HTML view (cordova ui)
236
- // createPlayerInCordovaUI();
237
- createTransparentPlayer();
238
-
239
- } else if (!config.isAudioOnly()) {
240
- createDialog();
241
- }
242
- preparePlayer(config.getUri());
234
+ String mediaUrl = config.getUri(); // Your method to get the URL
235
+ if (mediaUrl != null && URLUtil.isValidUrl(mediaUrl)) {
236
+ // Proceed with ExoPlayer setup using mediaUrl
237
+ if (config.useInlineView()) {
238
+ // Using a dialog doesn't work for us, as controls are drawn in HTML view (cordova ui)
239
+ // createPlayerInCordovaUI();
240
+ createTransparentPlayer();
241
+
242
+ } else if (!config.isAudioOnly()) {
243
+ createDialog();
244
+ }
245
+ preparePlayer(config.getUri());
243
246
 
244
- if (config.useInlineView()) {
245
- setController(config.getController());
247
+ if (config.useInlineView()) {
248
+ setController(config.getController());
249
+ }
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: " + uri);
246
254
  }
247
255
  }
248
256