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 +1 -1
- package/src/android/Payload.java +1 -0
- package/src/android/Player.java +19 -11
package/package.json
CHANGED
package/src/android/Payload.java
CHANGED
|
@@ -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.*;
|
package/src/android/Player.java
CHANGED
|
@@ -231,18 +231,26 @@ public class Player {
|
|
|
231
231
|
public void createPlayer() {
|
|
232
232
|
Log.i(TAG, "Playing " + config.getUri());
|
|
233
233
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
//
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
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
|
-
|
|
245
|
-
|
|
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
|
|