cordova-plugin-media3 1.1.34 → 2.0.0

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/README.md CHANGED
@@ -1,8 +1,91 @@
1
- # Cordova Media3 exoplayer Plugin
1
+ [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE) [![Build Status](https://travis-ci.org/frontyard/cordova-plugin-exoplayer.svg?branch=2.0.0)](https://travis-ci.org/frontyard/cordova-plugin-exoplayer) [![Code Climate](https://codeclimate.com/github/frontyard/cordova-plugin-exoplayer/badges/gpa.svg)](https://codeclimate.com/github/frontyard/cordova-plugin-exoplayer) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2ZPEB7VKFG2CY)
2
2
 
3
- Cordova media3 exoplayer plugin.
3
+ ## THIS PLUGIN IS WORKING & MAINTAINED
4
4
 
5
- this plugin was imported and adjusted to media3 Exoplayer based on the plugin of cordova-plugin-exoplayer https://codeclimate.com/github/frontyard/cordova-plugin-exoplayer
5
+ # Cordova ExoPlayer Plugin
6
+
7
+ Cordova media player plugin using Google's ExoPlayer framework.
8
+
9
+ Please send us links to your cool projects made with this plugin so we can include them on this page!
10
+
11
+ ## Keeping track of exoplayer versions here:
12
+ |plugin|exoplayer|
13
+ |-----|---------|
14
+ |2.6.0|2.18.1|
15
+ |2.5.7|2.18.1|
16
+ |2.5.6|2.9.6|
17
+ |2.5.5|2.8.1|
18
+ |2.5.4|2.6.1|
19
+
20
+ ## Changes in version 2.6.0
21
+ Add alternative constructor to allow creation of player without Android UI
22
+ - New feature, hence change in package minor version
23
+ Fix crash at playback start
24
+
25
+ ## Changes in version 2.5.7
26
+ Upgrade exoplayer to 2.18.1
27
+ Merge changes from netmikey fork
28
+ - Various updates needed to remove `SimpleExoPlayer`
29
+
30
+ ## Changin in version 2.5.6
31
+ Upgraded exoplayer to 2.9.6
32
+
33
+ Upgrading to following versions is now possible
34
+ cordova: 11.0.0 (latest)
35
+ cordova-android: ^9.1.0
36
+
37
+ ## Changes in version 2.5.4
38
+ - Added loading progress bar to the top that shows up when player is buffering. This needs to be explicitly turned on with `showBuffering` boolean configuration setting.
39
+ - Added ability to change text, buttons and buffering colors using new controller configuration settings `textColor`, `buttonsColor` and `bufferingColor`.
40
+ - Added positionInFirstPeriod to TIMELINE_EVENT.
41
+ - Upgraded exoplayer to 2.6.1.
42
+
43
+ ## Changes in version 2.5.3
44
+ - After observing performance issues removing the usage of okhttp.
45
+ - Removing the 'android.hardware.touchscreen' check before adding touch handler. This feature is not reliably reported by various devices.
46
+
47
+ ## Changes in version 2.5.2
48
+ - Upgraded exoplayer to version 2.5.1
49
+ - Only adding touchscreen event handler if device has "android.hardware.touchscreen" system feature.
50
+ - Added `connectTimeout`, `readTimeout` and `retryCount` configuration settings. These are related to http client player uses.
51
+ - Added `seekBy` which is simmilar to seekTo but operates relative to the current possition. Value can be positive (seek forward) or negative (seek backwards).
52
+
53
+ ## Changes in version 2.5.1
54
+ - Added boolean options `hidePosition` and `hideDuration`. When playing dvr content thise numbers are relative to current time and very confusing to users. Adding ability to hide the numbers until better solution can be found.
55
+ - Added `autoPlay` (defaults to true) to allow user not to play the stream automatically. Must call `play` explicitly.
56
+
57
+ ## Changes in version 2.5.0
58
+ - Removed configuration setting `skipTime` and replaced it with separate `forwardTime` and `rewindTime`.
59
+ - Sending `TIMELINE_EVENT` to Cordova with `periodDurationX` and `periodWindowPositionX` properties for duration and window position for each period (marked X) in the stream.
60
+
61
+ ## Changes in version 2.4.5
62
+ - Added `setController` method to update the controller mid-stream. It accepts the same controller object that is used as part of parameters for `show` method.
63
+
64
+ ## Changes in version 2.4.4
65
+ - Added `stop` method to fully stop the stream but not realease the player. Call `setStream` to restart the playback or `close` to dispose of it.
66
+
67
+ ## Changes in version 2.4.2
68
+ - Plugin no longer acts on audio focus event but rather let's Cordova app decide what to do.
69
+
70
+ ## Changes in version 2.4.1
71
+ - When audio focus changes, plugin will send `AUDIO_FOCUS_EVENT` with parameter `audioFocus` that can be on of:
72
+ `AUDIOFOCUS_LOSS_TRANSIENT`, `AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK`, `AUDIOFOCUS_GAIN`, `AUDIOFOCUS_LOSS`.
73
+
74
+ ## Changes in version 2.4.0
75
+ - Controller will no longer show automatically on touch and key events.
76
+ - Added showController and hideController methods for explicit control of controller visibility.
77
+ - Plugin will not longer close on KEYCODE_BACK key event, please call .close() explicitly.
78
+ - Plugin will request audio focus on startup. It will also listen for audio focus events and pause/play on those events. It will close on AUDIOFOCUS_LOSS.
79
+ - START_EVENT will return additional info `audioFocus` which can be AUDIOFOCUS_REQUEST_FAILED or AUDIOFOCUS_REQUEST_GRANTED.
80
+ - STATE_EVENT will return additional info `controllerVisible` to tell the app if controller is visible or not.
81
+
82
+ ## Changes in version 2.3.0
83
+
84
+ - Renamed plugin's namespace from window.exoplayer to window.ExoPlayer
85
+ - Removed `init` method as there is no need to keep instance of the plugin around. Just call methods directly on window.ExoPlayer
86
+ - `show` now takes configuration parameters as the first argumeent since we don't need init any more.
87
+ - Renamed `playOffset` configuration setting to `seekTo` to match the coresponding method that does the same thing
88
+ - Replaced `play` and `pause` methods with single `playPause` that does both and keeps track of playback status
6
89
 
7
90
  ## Using
8
91
 
@@ -13,7 +96,7 @@ Create a new Cordova Project
13
96
  Install the plugin
14
97
 
15
98
  $ cd hello
16
- $ cordova plugin add cordova-plugin-exoplayer
99
+ $ cordova plugin add cordova-plugin-exoplayer-tv
17
100
 
18
101
 
19
102
  Edit `www/js/index.js` and add the following code inside `onDeviceReady`
@@ -160,11 +243,16 @@ Run the code
160
243
 
161
244
  cordova run
162
245
 
246
+ ## IONIC
247
+
248
+ For examples of using this plugin in an [IONIC](https://ionicframework.com/) app please see [this thread](https://github.com/frontyard/cordova-plugin-exoplayer/issues/4).
249
+
250
+ For IONIC Native see [npm module](https://www.npmjs.com/package/@ionic-native/android-exoplayer).
163
251
 
164
252
  ## Contributing
165
253
 
166
254
  1. Fork it
167
- 2. Create your feature branch off of current upstram branch (currently 1.0.7)
255
+ 2. Create your feature branch off of current upstram branch (currently 2.0.0)
168
256
  3. Commit and push your changes to that branch
169
257
  4. Create new Pull Request
170
258
 
@@ -174,14 +262,21 @@ For more information on setting up Cordova see [the documentation](http://cordov
174
262
 
175
263
  For more info on plugins see the [Plugin Development Guide](http://cordova.apache.org/docs/en/latest/guide/hybrid/plugins/index.html)
176
264
 
177
- General Media3 ExoPlayer [documentation](https://developer.android.com/media/media3/)
265
+ General ExoPlayer [documentation](https://google.github.io/ExoPlayer/)
266
+
267
+ ExoPlayer [source code](https://github.com/google/ExoPlayer)
268
+ https://github.com/frontyard/cordova-plugin-exoplayer
269
+
270
+ ## Donation
271
+ If this project helps you consider donating to support it!
178
272
 
273
+ [![paypal](https://cdn.rawgit.com/twolfson/paypal-github-button/1.0.0/dist/button.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2ZPEB7VKFG2CY)
179
274
 
180
275
  ## License
181
276
 
182
277
  The MIT License (MIT)
183
278
 
184
- Copyright (c) 2025 Naja7host
279
+ Copyright (c) 2017-2018 Nedim Cholich
185
280
 
186
281
  Permission is hereby granted, free of charge, to any person obtaining a copy
187
282
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cordova-plugin-media3",
3
- "version": "1.1.034",
4
- "description": "Media player for Cordova using Google's media3 ExoPlayer framework",
3
+ "version": "2.0.0",
4
+ "description": "Media player for Cordova using AndroidX Media3 ExoPlayer",
5
5
  "cordova": {
6
6
  "id": "cordova-plugin-media3",
7
7
  "platforms": [
@@ -27,6 +27,6 @@
27
27
  "version": ">=4.0.0"
28
28
  }
29
29
  ],
30
- "author": "Mohamed Anouar Achoukhy (Naja7host)",
30
+ "author": "Mohamed Anouar Achoukhy",
31
31
  "license": "MIT"
32
32
  }
package/plugin.xml CHANGED
@@ -3,9 +3,9 @@
3
3
  id="cordova-plugin-exoplayer-tv"
4
4
  version="2.6.0">
5
5
 
6
- <name>ExoPlayer</name>
7
- <description>Cordova Plugin implementing ExoPlayer video/audio player</description>
8
- <keywords>ecosystem:cordova,cordova-android,phonegap,cordova,ionic,android,exoplayer,exo,video,player</keywords>
6
+ <name>Media3</name>
7
+ <description>Cordova Plugin implementing Media3 ExoPlayer video/audio player</description>
8
+ <keywords>ecosystem:cordova,cordova-android,phonegap,cordova,ionic,android,exoplayer,media3,exo,video,player</keywords>
9
9
  <license>MIT</license>
10
10
 
11
11
  <engines>
@@ -19,37 +19,25 @@
19
19
  </js-module>
20
20
 
21
21
  <platform name="android">
22
- <framework src="androidx.media3:media3-exoplayer:1.8.0"/>
23
- <framework src="androidx.media3:media3-exoplayer-hls:1.8.0"/>
24
- <framework src="androidx.media3:media3-exoplayer-dash:1.8.0"/>
25
- <framework src="androidx.media3:media3-exoplayer-smoothstreaming:1.8.0"/>
26
- <framework src="androidx.media3:media3-ui:1.8.0"/>
27
- <framework src="androidx.media3:media3-common:1.8.0"/>
28
- <framework src="androidx.media3:media3-datasource:1.8.0"/>
29
- <framework src="androidx.media3:media3-extractor:1.8.0"/>
30
- <framework src="androidx.media3:media3-decoder:1.8.0"/>
31
- <!-- <framework src="androidx.media3:media3-session:1.8.0"/> -->
32
- <!-- <framework src="androidx.media3:media3-exoplayer-ffmpeg:1.0.0"/> -->
33
- <framework src="org.jellyfin.media3:media3-ffmpeg-decoder:1.8.0+1"/>
34
- <framework src="com.squareup.picasso:picasso:2.8"/>
35
- <framework src="com.squareup.okhttp3:okhttp:5.2.0"/>
22
+ <framework src="androidx.media3:media3-exoplayer:1.9.0"/>
23
+ <framework src="androidx.media3:media3-exoplayer-dash:1.9.0"/>
24
+ <framework src="androidx.media3:media3-exoplayer-hls:1.9.0"/>
25
+ <framework src="androidx.media3:media3-exoplayer-smoothstreaming:1.9.0"/>
26
+ <framework src="androidx.media3:media3-ui:1.9.0"/>
27
+ <framework src="androidx.media3:media3-datasource:1.9.0"/>
28
+ <framework src="org.jellyfin.media3:media3-ffmpeg-decoder:1.9.0+1"/>
29
+ <!-- <framework src="com.squareup.picasso:picasso:2.8"/> -->
30
+ <!-- <framework src="org.videolan.android:libvlc-all:jar:4.0.0-eap20"/> -->
31
+ <!-- https://github.com/saoron/VLCPlugin -->
32
+ <!-- https://code.videolan.org/videolan/libvlc-android-samples -->
36
33
 
37
34
  <config-file target="res/xml/config.xml" parent="/*">
38
35
  <feature name="ExoPlayer">
39
- <param name="android-package" value="ma.naja7host.cordova.plugin.exoplayer.Plugin"/>
36
+ <param name="android-package" value="co.frontyard.cordova.plugin.exoplayer.Plugin"/>
40
37
  </feature>
41
38
  </config-file>
42
39
 
43
- <edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application/activity[@android:name='MainActivity']">
44
- <activity android:resizeableActivity="true"
45
- android:supportsPictureInPicture="true"
46
- android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
47
- android:launchMode="singleTask">
48
- </activity>
49
-
50
- </edit-config>
51
-
52
- <!-- <source-file src="src/res/values/ids.xml" target-dir="res/values/"/>
40
+ <source-file src="src/res/values/ids.xml" target-dir="res/values/"/>
53
41
  <source-file src="src/res/values/constants.xml" target-dir="res/values/"/>
54
42
  <source-file src="src/res/values/styles.xml" target-dir="res/values/"/>
55
43
 
@@ -62,13 +50,14 @@
62
50
  <source-file src="src/res/drawable/pause.png" target-dir="res/drawable/"/>
63
51
  <source-file src="src/res/drawable/play.png" target-dir="res/drawable/"/>
64
52
  <source-file src="src/res/drawable/previous.png" target-dir="res/drawable/"/>
65
- <source-file src="src/res/drawable/rewind.png" target-dir="res/drawable/"/> -->
66
-
67
- <source-file src="src/android/CallbackResponse.java" target-dir="src/ma/naja7host/cordova/plugin/exoplayer/"/>
68
- <source-file src="src/android/Configuration.java" target-dir="src/ma/naja7host/cordova/plugin/exoplayer/"/>
69
- <source-file src="src/android/LayoutProvider.java" target-dir="src/ma/naja7host/cordova/plugin/exoplayer/"/>
70
- <source-file src="src/android/Payload.java" target-dir="src/ma/naja7host/cordova/plugin/exoplayer/"/>
71
- <source-file src="src/android/Player.java" target-dir="src/ma/naja7host/cordova/plugin/exoplayer/"/>
72
- <source-file src="src/android/Plugin.java" target-dir="src/ma/naja7host/cordova/plugin/exoplayer/"/>
53
+ <source-file src="src/res/drawable/rewind.png" target-dir="res/drawable/"/>
54
+
55
+ <source-file src="src/android/CallbackResponse.java" target-dir="src/co/frontyard/cordova/plugin/exoplayer/"/>
56
+ <source-file src="src/android/Configuration.java" target-dir="src/co/frontyard/cordova/plugin/exoplayer/"/>
57
+ <source-file src="src/android/LayoutProvider.java" target-dir="src/co/frontyard/cordova/plugin/exoplayer/"/>
58
+ <source-file src="src/android/Payload.java" target-dir="src/co/frontyard/cordova/plugin/exoplayer/"/>
59
+ <source-file src="src/android/Player.java" target-dir="src/co/frontyard/cordova/plugin/exoplayer/"/>
60
+ <source-file src="src/android/Plugin.java" target-dir="src/co/frontyard/cordova/plugin/exoplayer/"/>
61
+ <!-- <source-file src="src/android/DeviceDetector.java" target-dir="src/co/frontyard/cordova/plugin/exoplayer/"/> -->
73
62
  </platform>
74
63
  </plugin>
@@ -21,7 +21,7 @@
21
21
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  SOFTWARE.
23
23
  */
24
- package ma.naja7host.cordova.plugin.exoplayer;
24
+ package co.frontyard.cordova.plugin.exoplayer;
25
25
 
26
26
  import org.apache.cordova.*;
27
27
  import org.json.*;
@@ -21,7 +21,7 @@
21
21
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  SOFTWARE.
23
23
  */
24
- package ma.naja7host.cordova.plugin.exoplayer;
24
+ package co.frontyard.cordova.plugin.exoplayer;
25
25
 
26
26
  import android.net.*;
27
27
  import android.view.*;
@@ -21,7 +21,7 @@
21
21
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  SOFTWARE.
23
23
  */
24
- package ma.naja7host.cordova.plugin.exoplayer;
24
+ package co.frontyard.cordova.plugin.exoplayer;
25
25
 
26
26
  import android.app.*;
27
27
  import android.graphics.*;
@@ -29,15 +29,13 @@ import android.util.*;
29
29
  import android.view.*;
30
30
  import android.widget.*;
31
31
 
32
- import androidx.media3.common.ForwardingPlayer;
33
- import androidx.media3.ui.*;
34
- import java.lang.String;
32
+ import androidx.media3.common.util.UnstableApi;
33
+ import androidx.media3.ui.AspectRatioFrameLayout;
34
+ import androidx.media3.ui.PlayerView;
35
35
 
36
36
  import org.json.*;
37
- import com.squareup.picasso.*;
38
-
39
- import android.util.Log;
40
37
 
38
+ @UnstableApi
41
39
  public class LayoutProvider {
42
40
  public static final String TAG = "LayoutProvider";
43
41
 
@@ -98,8 +96,8 @@ public class LayoutProvider {
98
96
  ((ViewGroup) imageButton.getParent()).removeView(imageButton);
99
97
  }
100
98
  else {
101
- // Loading from external source.
102
- Picasso.get().load(buttonUrl).into(imageButton);
99
+ // // Loading from external source.
100
+ // Picasso.get().load(buttonUrl).into(imageButton);
103
101
  }
104
102
  }
105
103
  else if (null != buttonsColor) {
@@ -144,7 +142,7 @@ public class LayoutProvider {
144
142
  }
145
143
  }
146
144
  if(null != streamImage) {
147
- Picasso.get().load(streamImage).into(imageView);
145
+ // Picasso.get().load(streamImage).into(imageView);
148
146
  }
149
147
  if(null != streamTitle) {
150
148
  titleView.setText(streamTitle);
@@ -21,41 +21,39 @@
21
21
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  SOFTWARE.
23
23
  */
24
- package ma.naja7host.cordova.plugin.exoplayer;
24
+ package co.frontyard.cordova.plugin.exoplayer;
25
25
 
26
- import android.util.Log;
27
26
  import android.view.*;
28
- import androidx.media3.common.Player;
29
- import androidx.media3.common.*;
30
- import androidx.media3.exoplayer.*;
31
- import androidx.media3.exoplayer.trackselection.*;
27
+
32
28
  import androidx.media3.common.C;
33
29
  import androidx.media3.common.Format;
30
+ import androidx.media3.common.PlaybackException;
31
+ import androidx.media3.common.Timeline;
34
32
  import androidx.media3.common.Tracks;
35
- // import com.google.android.exoplayer2.video.*;
33
+ import androidx.media3.common.util.UnstableApi;
34
+ import androidx.media3.exoplayer.ExoPlaybackException;
35
+ import androidx.media3.exoplayer.ExoPlayer;
36
+
36
37
  import java.lang.*;
37
- import java.lang.Boolean;
38
- import java.lang.Integer;
39
- import java.lang.StackTraceElement;
40
- import java.lang.StringBuffer;
41
38
  import java.util.*;
42
39
  import org.json.*;
43
40
 
41
+ @UnstableApi
44
42
  public class Payload {
45
43
 
46
44
  public static String playbackStateToString(int playbackState) {
47
45
  String state = "UNKNOWN";
48
46
  switch (playbackState) {
49
- case Player.STATE_IDLE:
47
+ case ExoPlayer.STATE_IDLE:
50
48
  state = "STATE_IDLE";
51
49
  break;
52
- case Player.STATE_BUFFERING:
50
+ case ExoPlayer.STATE_BUFFERING:
53
51
  state = "STATE_BUFFERING";
54
52
  break;
55
- case Player.STATE_READY:
53
+ case ExoPlayer.STATE_READY:
56
54
  state = "STATE_READY";
57
55
  break;
58
- case Player.STATE_ENDED:
56
+ case ExoPlayer.STATE_ENDED:
59
57
  state = "STATE_ENDED";
60
58
  break;
61
59
  }
@@ -271,9 +269,9 @@ public class Payload {
271
269
  audioArray.put(trackObj);
272
270
  break;
273
271
  case C.TRACK_TYPE_TEXT:
274
- // if (format.sampleMimeType == "application/vobsub") {
275
- // continue;
276
- // }
272
+ if (format.sampleMimeType == "application/vobsub") {
273
+ continue;
274
+ }
277
275
 
278
276
  if (format.language == null) {
279
277
  continue;
@@ -314,54 +312,4 @@ public class Payload {
314
312
  }
315
313
  }
316
314
  }
317
-
318
- // public static JSONObject audioTrackeEvent(ExoPlayer player) {
319
- // Map<String, String> map = new HashMap<String, String>();
320
- // Tracks currentTracks = player.getCurrentTracks();
321
- // JSONObject result = new JSONObject();
322
- // JSONArray audioArray = new JSONArray();
323
- // JSONArray subtitleArray = new JSONArray();
324
-
325
- // if (currentTracks == null) return result;
326
-
327
- // for (Tracks.Group group : currentTracks.getGroups()) {
328
- // int trackType = group.getType();
329
-
330
- // if (trackType == C.TRACK_TYPE_AUDIO) {
331
- // for (int i = 0; i < group.length; i++) {
332
- // Format format = group.getTrackFormat(i);
333
- // Log.d("Tracks", "Audio: " + format.language + " | " + format.sampleRate + "Hz");
334
- // map.put("Audios" + i, "Audio: " + format.language + " | " + format.sampleRate + "Hz");
335
- // }
336
- // }
337
-
338
- // if (trackType == C.TRACK_TYPE_TEXT) {
339
- // for (int i = 0; i < group.length; i++) {
340
- // Format format = group.getTrackFormat(i);
341
- // Log.d("Tracks", "Subtitle: " + format.language + " | " + format.sampleMimeType);
342
- // map.put("Subtitles" + i, "Subtitle: " + format.language + " | " + format.sampleMimeType);
343
- // }
344
- // }
345
- // }
346
- // map.put("eventType", "AUDIO_TRACK_EVENT");
347
- // // map.put("controllerVisible", Boolean.toString(controllerVisible));
348
- // return new JSONObject(map);
349
- // }
350
-
351
- // // public static JSONObject resolutionEvent(ExoPlayer player, int videoWidth, int videoHeight) {
352
- // Map<String, String> map = new HashMap<String, String>();
353
- // map.put("eventType", "RESOLUTION_EVENT");
354
- // map.put("width", Integer.toString(videoWidth));
355
- // map.put("height", Integer.toString(videoHeight));
356
- // return new JSONObject(map);
357
- // }
358
-
359
- // public static JSONObject videoSizeChangedEvent(ExoPlayer player, VideoSize videoSize) {
360
- // Map<String, String> map = new HashMap<String, String>();
361
- // map.put("eventType", "VIDEO_SIZE_CHANGED_EVENT");
362
- // map.put("width", Integer.toString(videoSize.width));
363
- // map.put("height", Integer.toString(videoSize.height));
364
- // // addPlayerState(map, player);
365
- // return new JSONObject(map);
366
- // }
367
315
  }