cordova-plugin-media3 1.1.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/.travis.yml +0 -0
- package/CODE_OF_CONDUCT.md +46 -0
- package/CONTRIBUTING.md +4 -0
- package/LICENSE +21 -0
- package/README.md +297 -0
- package/package.json +32 -0
- package/plugin.xml +61 -0
- package/src/android/CallbackResponse.java +53 -0
- package/src/android/Configuration.java +104 -0
- package/src/android/DeviceDetector.java +132 -0
- package/src/android/LayoutProvider.java +218 -0
- package/src/android/Payload.java +361 -0
- package/src/android/Player.java +1063 -0
- package/src/android/Plugin.java +287 -0
- package/src/res/drawable/fastforward.png +0 -0
- package/src/res/drawable/next.png +0 -0
- package/src/res/drawable/pause.png +0 -0
- package/src/res/drawable/play.png +0 -0
- package/src/res/drawable/previous.png +0 -0
- package/src/res/drawable/rewind.png +0 -0
- package/src/res/layout/exo_playback_control_view.xml +121 -0
- package/src/res/layout/exo_rounded_corners.xml +6 -0
- package/src/res/layout/exo_simple_player_view.xml +58 -0
- package/src/res/values/constants.xml +23 -0
- package/src/res/values/ids.xml +9 -0
- package/src/res/values/styles.xml +52 -0
- package/www/exoplayer.js +91 -0
package/.travis.yml
ADDED
|
Binary file
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
## Our Standards
|
|
8
|
+
|
|
9
|
+
Examples of behavior that contributes to creating a positive environment include:
|
|
10
|
+
|
|
11
|
+
* Using welcoming and inclusive language
|
|
12
|
+
* Being respectful of differing viewpoints and experiences
|
|
13
|
+
* Gracefully accepting constructive criticism
|
|
14
|
+
* Focusing on what is best for the community
|
|
15
|
+
* Showing empathy towards other community members
|
|
16
|
+
|
|
17
|
+
Examples of unacceptable behavior by participants include:
|
|
18
|
+
|
|
19
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
|
20
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
21
|
+
* Public or private harassment
|
|
22
|
+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
|
23
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
24
|
+
|
|
25
|
+
## Our Responsibilities
|
|
26
|
+
|
|
27
|
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
|
28
|
+
|
|
29
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
|
30
|
+
|
|
31
|
+
## Scope
|
|
32
|
+
|
|
33
|
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
|
34
|
+
|
|
35
|
+
## Enforcement
|
|
36
|
+
|
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at github@frontyard.co. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
|
38
|
+
|
|
39
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
|
40
|
+
|
|
41
|
+
## Attribution
|
|
42
|
+
|
|
43
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
|
44
|
+
|
|
45
|
+
[homepage]: http://contributor-covenant.org
|
|
46
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
package/CONTRIBUTING.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Nedim Cholich
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
[](LICENSE) [](https://travis-ci.org/frontyard/cordova-plugin-exoplayer) [](https://codeclimate.com/github/frontyard/cordova-plugin-exoplayer) [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2ZPEB7VKFG2CY)
|
|
2
|
+
|
|
3
|
+
## THIS PLUGIN IS NO LONGER MAINTAINED, I suggest you find a fork that is still being worked on or create a fork of your own! Thank you for your support 🫶
|
|
4
|
+
|
|
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
|
|
89
|
+
|
|
90
|
+
## Using
|
|
91
|
+
|
|
92
|
+
Create a new Cordova Project
|
|
93
|
+
|
|
94
|
+
$ cordova create hello com.example.helloapp Hello
|
|
95
|
+
|
|
96
|
+
Install the plugin
|
|
97
|
+
|
|
98
|
+
$ cd hello
|
|
99
|
+
$ cordova plugin add cordova-plugin-exoplayer
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
Edit `www/js/index.js` and add the following code inside `onDeviceReady`
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
var successCallback = function(json) {
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
var errorCallback = function(error) {
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
var params = {
|
|
112
|
+
url: "http://www.youtube.com/api/manifest/dash/id/bf5bb2419360daf1/source/youtube?as=fmp4_audio_clear,fmp4_sd_hd_clear&sparams=ip,ipbits,expire,source,id,as&ip=0.0.0.0&ipbits=0&expire=19000000000&signature=51AF5F39AB0CEC3E5497CD9C900EBFEAECCCB5C7.8506521BFC350652163895D4C26DEE124209AA9E&key=ik0"
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
window.ExoPlayer.show(parameters, successCallback, errorCallback);
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Plugin methods exported via window.ExoPlayer
|
|
119
|
+
```js
|
|
120
|
+
{
|
|
121
|
+
setStream(url, controllerConfig) // switch stream without disposing of the player. controllerConfig is "controller" part of the inital parameters.
|
|
122
|
+
playPause() // will pause if playing and play if paused :-)
|
|
123
|
+
stop() // will stop the current stream
|
|
124
|
+
seekTo(milliseconds) // jump to particular poing into the stream
|
|
125
|
+
getState(successCallback, errorCallback) // returns player state
|
|
126
|
+
showController() // shows player controller
|
|
127
|
+
hideController() // hides player controller
|
|
128
|
+
setController() // sets `controller` part of configuration related to the info bar and control buttons.
|
|
129
|
+
close() // close and dispose of player, very important to call this method when your app exits!
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
This is what `parameters` look like for the `show` call, most of them are optional:
|
|
134
|
+
```js
|
|
135
|
+
{
|
|
136
|
+
url: 'https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8',
|
|
137
|
+
userAgent: 'MyAwesomePlayer', // default is 'ExoPlayerPlugin'
|
|
138
|
+
aspectRatio: 'FILL_SCREEN', // default is FIT_SCREEN
|
|
139
|
+
hideTimeout: 5000, // Hide controls after this many milliseconds, default is 5 sec
|
|
140
|
+
autoPlay: true, // When set to false stream will not automatically start
|
|
141
|
+
seekTo: 10 * 60 * 60 * 1000, // Start playback 10 minutes into video specified in ms, default is 0
|
|
142
|
+
forwardTime: 60 * 1000, // Amount of time in ms to use when skipping forward, default is 1 min
|
|
143
|
+
rewindTime: 60 * 1000, // Amount of time in ms to use when skipping backward, default is 1 min
|
|
144
|
+
audioOnly: true, // Only play audio in the backgroud, default is false
|
|
145
|
+
subtitleUrl: 'http://url.to/subtitle.srt', // Optional subtitle url
|
|
146
|
+
connectTimeout: 1000, // http connect timeout in ms (default is 0)
|
|
147
|
+
readTimeout: 1000, // http read timeout in ms (default is 0)
|
|
148
|
+
retryCount: 5, // Number of times datasource will retry the stream before giving up (default is 3)
|
|
149
|
+
showBuffering: true, // When buffering, player will show indicator at the top of the screen, default is false
|
|
150
|
+
controller: { // If this object is not present controller will not be visible
|
|
151
|
+
streamImage: 'http://url.to/channel.png',
|
|
152
|
+
streamTitle: 'Cool channel / movie',
|
|
153
|
+
streamDescription: '2nd line you can use to display whatever you want like current program epg or movie description',
|
|
154
|
+
hideProgress: true, // Hide entire progress timebar
|
|
155
|
+
hidePosition: false, // If timebar is visible hide current position from it
|
|
156
|
+
hideDuration: false, // If timebar is visible Hide stream duration from it
|
|
157
|
+
controlIcons: {
|
|
158
|
+
'exo_rew': null, // Set to null to remove the button from the player
|
|
159
|
+
'exo_play': 'http://url.to/play.png',
|
|
160
|
+
'exo_pause': 'http://url.to/pause.png',
|
|
161
|
+
//'exo_ffwd': null, // Buttons not included in configuration will show up as default ExoPlayer buttons
|
|
162
|
+
},
|
|
163
|
+
textColor: '#ffff0000', // These colors can be any valid Android color
|
|
164
|
+
buttonsColor: '#ff00ff00', // This example uses hex values including alpha (first byte)
|
|
165
|
+
bufferingColor: '#ff0000ff' // Alpha of 'ff' makes it 100% opaque
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
Controller is composed of several pieces. To the left there is optional streamImage, followed by two lines on the right, top and bottom. Top line is reserved for streamTitle, while bottom line can either be streamDescription or progress bar. If you provide streamDescription, progress bar will not be visible. Optionaly you can turn off progress bar by passing hideProgress: true if you don't want to show either.
|
|
170
|
+
|
|
171
|
+
Playback control buttons are centered on the screen and use default ExoPlayer icons. Optionally you can override these by your own images via controlIcons object.
|
|
172
|
+
|
|
173
|
+
You can pass `subtitleUrl` for subtitle to be shown over the video. We currently support .srt and .vtt subtitle formats. Subtitles are not supported on all stream types, as ExoPlayer has requirement that both video and subtitle "must have the same number of periods, and must not have any dynamic windows", which means for simple mp4s it should work, but on more complex HLS/Dash setups it might not.
|
|
174
|
+
|
|
175
|
+
If you pass in `audioOnly: true`, make sure to manually close the player on some event (like escape button) since the plugin won't be detecting keypresses when playing audio in the background.
|
|
176
|
+
|
|
177
|
+
If you want to show default control buttons (play/pause, rewind, forward) you need an empty controlIncons object:
|
|
178
|
+
```js
|
|
179
|
+
controlIcons: {
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Plugin will send following events back to Cordova app through successCallback specified through show function:
|
|
184
|
+
```js
|
|
185
|
+
START_EVENT
|
|
186
|
+
STOP_EVENT
|
|
187
|
+
KEY_EVENT
|
|
188
|
+
TOUCH_EVENT
|
|
189
|
+
LOADING_EVENT
|
|
190
|
+
STATE_CHANGED_EVENT
|
|
191
|
+
POSITION_DISCONTINUITY_EVENT
|
|
192
|
+
SEEK_EVENT
|
|
193
|
+
PLAYER_ERROR_EVENT
|
|
194
|
+
TIMELINE_EVENT
|
|
195
|
+
```
|
|
196
|
+
Each event will send JSON payload coresponding to that event. Some events (where appropriate) will also send additional information about playback like duration, postion, etc.
|
|
197
|
+
|
|
198
|
+
Example of key events:
|
|
199
|
+
```js
|
|
200
|
+
{
|
|
201
|
+
'eventType':'KEY_EVENT',
|
|
202
|
+
'eventAction':'ACTION_DOWN',
|
|
203
|
+
'eventKeycode':'KEYCODE_VOLUME_UP'
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
{
|
|
207
|
+
'eventType':'KEY_EVENT',
|
|
208
|
+
'eventAction':'ACTION_UP',
|
|
209
|
+
'eventKeycode':'KEYCODE_VOLUME_UP'
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
Example of touch events:
|
|
215
|
+
```js
|
|
216
|
+
{
|
|
217
|
+
'eventType':'TOUCH_EVENT',
|
|
218
|
+
'eventAction':'ACTION_DOWN',
|
|
219
|
+
'eventAxisX':543,
|
|
220
|
+
'eventAxisY':1321.8009033203125
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
{
|
|
224
|
+
'eventType':'TOUCH_EVENT',
|
|
225
|
+
'eventAction':'ACTION_MOVE',
|
|
226
|
+
'eventAxisX':543,
|
|
227
|
+
'eventAxisY':1320.5
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
{
|
|
231
|
+
'eventType':'TOUCH_EVENT',
|
|
232
|
+
'eventAction':'ACTION_UP',
|
|
233
|
+
'eventAxisX':543,
|
|
234
|
+
'eventAxisY':1320.5
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Install Android platform
|
|
239
|
+
|
|
240
|
+
cordova platform add android
|
|
241
|
+
|
|
242
|
+
Run the code
|
|
243
|
+
|
|
244
|
+
cordova run
|
|
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).
|
|
251
|
+
|
|
252
|
+
## Contributing
|
|
253
|
+
|
|
254
|
+
1. Fork it
|
|
255
|
+
2. Create your feature branch off of current upstram branch (currently 2.0.0)
|
|
256
|
+
3. Commit and push your changes to that branch
|
|
257
|
+
4. Create new Pull Request
|
|
258
|
+
|
|
259
|
+
## More Info
|
|
260
|
+
|
|
261
|
+
For more information on setting up Cordova see [the documentation](http://cordova.apache.org/docs/en/latest/guide/cli/index.html)
|
|
262
|
+
|
|
263
|
+
For more info on plugins see the [Plugin Development Guide](http://cordova.apache.org/docs/en/latest/guide/hybrid/plugins/index.html)
|
|
264
|
+
|
|
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!
|
|
272
|
+
|
|
273
|
+
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2ZPEB7VKFG2CY)
|
|
274
|
+
|
|
275
|
+
## License
|
|
276
|
+
|
|
277
|
+
The MIT License (MIT)
|
|
278
|
+
|
|
279
|
+
Copyright (c) 2017-2018 Nedim Cholich
|
|
280
|
+
|
|
281
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
282
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
283
|
+
in the Software without restriction, including without limitation the rights
|
|
284
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
285
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
286
|
+
furnished to do so, subject to the following conditions:
|
|
287
|
+
|
|
288
|
+
The above copyright notice and this permission notice shall be included in all
|
|
289
|
+
copies or substantial portions of the Software.
|
|
290
|
+
|
|
291
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
292
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
293
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
294
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
295
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
296
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
297
|
+
SOFTWARE.
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cordova-plugin-media3",
|
|
3
|
+
"version": "1.1.000",
|
|
4
|
+
"description": "Media player for Cordova using Google's media3 ExoPlayer framework",
|
|
5
|
+
"cordova": {
|
|
6
|
+
"id": "cordova-plugin-media3",
|
|
7
|
+
"platforms": [
|
|
8
|
+
"android"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"ecosystem:cordova",
|
|
13
|
+
"cordova-android",
|
|
14
|
+
"phonegap",
|
|
15
|
+
"cordova",
|
|
16
|
+
"ionic",
|
|
17
|
+
"android",
|
|
18
|
+
"exoplayer",
|
|
19
|
+
"media3",
|
|
20
|
+
"exo",
|
|
21
|
+
"video",
|
|
22
|
+
"player"
|
|
23
|
+
],
|
|
24
|
+
"engines": [
|
|
25
|
+
{
|
|
26
|
+
"name": "cordova",
|
|
27
|
+
"version": ">=4.0.0"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"author": "Mohamed Anouar Achoukhy (Naja7host)",
|
|
31
|
+
"license": "MIT"
|
|
32
|
+
}
|
package/plugin.xml
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
|
|
3
|
+
id="cordova-plugin-exoplayer-tv"
|
|
4
|
+
version="2.6.0">
|
|
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>
|
|
9
|
+
<license>MIT</license>
|
|
10
|
+
|
|
11
|
+
<engines>
|
|
12
|
+
<engine name="cordova-android" version=">=4.0.0"/>
|
|
13
|
+
</engines>
|
|
14
|
+
|
|
15
|
+
<asset src="www/exoplayer.js" target="js/exoplayer.js"/>
|
|
16
|
+
|
|
17
|
+
<js-module src="www/exoplayer.js" name="ExoPlayer">
|
|
18
|
+
<clobbers target="ExoPlayer"/>
|
|
19
|
+
</js-module>
|
|
20
|
+
|
|
21
|
+
<platform name="android">
|
|
22
|
+
<framework src="androidx.media3:media3-exoplayer:1.2.1"/>
|
|
23
|
+
<framework src="androidx.media3:media3-ui:1.2.1"/>
|
|
24
|
+
<framework src="androidx.media3:media3-common:1.2.1"/>
|
|
25
|
+
<framework src="androidx.media3:media3-datasource:1.2.1"/>
|
|
26
|
+
<framework src="androidx.media3:media3-extractor:1.2.1"/>
|
|
27
|
+
<framework src="androidx.media3:media3-decoder:1.2.1"/>
|
|
28
|
+
<framework src="androidx.media3:media3-session:1.2.1"/>
|
|
29
|
+
<framework src="androidx.media3:media3-decoder-ffmpeg:1.2.1"/>
|
|
30
|
+
<framework src="com.squareup.picasso:picasso:2.5.2"/>
|
|
31
|
+
|
|
32
|
+
<config-file target="res/xml/config.xml" parent="/*">
|
|
33
|
+
<feature name="ExoPlayer">
|
|
34
|
+
<param name="android-package" value="co.frontyard.cordova.plugin.exoplayer.Plugin"/>
|
|
35
|
+
</feature>
|
|
36
|
+
</config-file>
|
|
37
|
+
|
|
38
|
+
<source-file src="src/res/values/ids.xml" target-dir="res/values/"/>
|
|
39
|
+
<source-file src="src/res/values/constants.xml" target-dir="res/values/"/>
|
|
40
|
+
<source-file src="src/res/values/styles.xml" target-dir="res/values/"/>
|
|
41
|
+
|
|
42
|
+
<source-file src="src/res/layout/exo_simple_player_view.xml" target-dir="res/layout/"/>
|
|
43
|
+
<source-file src="src/res/layout/exo_playback_control_view.xml" target-dir="res/layout/"/>
|
|
44
|
+
<source-file src="src/res/layout/exo_rounded_corners.xml" target-dir="res/layout/"/>
|
|
45
|
+
|
|
46
|
+
<source-file src="src/res/drawable/fastforward.png" target-dir="res/drawable/"/>
|
|
47
|
+
<source-file src="src/res/drawable/next.png" target-dir="res/drawable/"/>
|
|
48
|
+
<source-file src="src/res/drawable/pause.png" target-dir="res/drawable/"/>
|
|
49
|
+
<source-file src="src/res/drawable/play.png" target-dir="res/drawable/"/>
|
|
50
|
+
<source-file src="src/res/drawable/previous.png" target-dir="res/drawable/"/>
|
|
51
|
+
<source-file src="src/res/drawable/rewind.png" target-dir="res/drawable/"/>
|
|
52
|
+
|
|
53
|
+
<source-file src="src/android/CallbackResponse.java" target-dir="src/co/frontyard/cordova/plugin/exoplayer/"/>
|
|
54
|
+
<source-file src="src/android/Configuration.java" target-dir="src/co/frontyard/cordova/plugin/exoplayer/"/>
|
|
55
|
+
<source-file src="src/android/LayoutProvider.java" target-dir="src/co/frontyard/cordova/plugin/exoplayer/"/>
|
|
56
|
+
<source-file src="src/android/Payload.java" target-dir="src/co/frontyard/cordova/plugin/exoplayer/"/>
|
|
57
|
+
<source-file src="src/android/Player.java" target-dir="src/co/frontyard/cordova/plugin/exoplayer/"/>
|
|
58
|
+
<source-file src="src/android/Plugin.java" target-dir="src/co/frontyard/cordova/plugin/exoplayer/"/>
|
|
59
|
+
<source-file src="src/android/DeviceDetector.java" target-dir="src/co/frontyard/cordova/plugin/exoplayer/"/>
|
|
60
|
+
</platform>
|
|
61
|
+
</plugin>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The MIT License (MIT)
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2017 Nedim Cholich
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
package co.frontyard.cordova.plugin.exoplayer;
|
|
25
|
+
|
|
26
|
+
import org.apache.cordova.*;
|
|
27
|
+
import org.json.*;
|
|
28
|
+
|
|
29
|
+
public class CallbackResponse {
|
|
30
|
+
private CallbackContext callbackContext;
|
|
31
|
+
|
|
32
|
+
public CallbackResponse(CallbackContext callbackContext) {
|
|
33
|
+
this.callbackContext = callbackContext;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public void send(PluginResult.Status status, boolean keepCallback) {
|
|
37
|
+
if (callbackContext == null) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
PluginResult result = new PluginResult(status);
|
|
41
|
+
result.setKeepCallback(keepCallback);
|
|
42
|
+
callbackContext.sendPluginResult(result);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public void send(PluginResult.Status status, JSONObject message, boolean keepCallback) {
|
|
46
|
+
if (callbackContext == null) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
PluginResult result = new PluginResult(status, message);
|
|
50
|
+
result.setKeepCallback(keepCallback);
|
|
51
|
+
callbackContext.sendPluginResult(result);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The MIT License (MIT)
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2017 Nedim Cholich
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
package co.frontyard.cordova.plugin.exoplayer;
|
|
25
|
+
|
|
26
|
+
import android.net.*;
|
|
27
|
+
import android.view.*;
|
|
28
|
+
import org.json.*;
|
|
29
|
+
|
|
30
|
+
public class Configuration {
|
|
31
|
+
private final JSONObject config;
|
|
32
|
+
|
|
33
|
+
public Configuration(JSONObject config) {
|
|
34
|
+
this.config = config;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public final Uri getUri() {
|
|
38
|
+
return Uri.parse(config.optString("url", ""));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public final JSONObject getDimensions() {
|
|
42
|
+
return config.optJSONObject("dimensions");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public String getUserAgent() {
|
|
46
|
+
return this.config.optString("userAgent", "ExoPlayerPlugin");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public boolean isAspectRatioFillScreen() {
|
|
50
|
+
return config.optString("aspectRatio", "FIT_SCREEN").equalsIgnoreCase("FILL_SCREEN");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public boolean isAudioOnly() {
|
|
54
|
+
return config.optBoolean("audioOnly");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public boolean useInlineView() {
|
|
58
|
+
return config.optBoolean("inlineView", true);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public boolean autoPlay() {
|
|
62
|
+
return config.optBoolean("autoPlay", true);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public long getSeekTo() {
|
|
66
|
+
return config.optLong("seekTo", -1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public final JSONObject getController() {
|
|
70
|
+
return config.optJSONObject("controller");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public int getHideTimeout() {
|
|
74
|
+
return config.optInt("hideTimeout", 5000); // Default 5 sec.
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public int getForwardTimeMs() {
|
|
78
|
+
return config.optInt("forwardTime", 60000); // Default 1 min.
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public int getRewindTimeMs() {
|
|
82
|
+
return config.optInt("rewindTime", 60000); // Default 1 min.
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public String getSubtitleUrl() {
|
|
86
|
+
return config.optString("subtitleUrl", null);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public int getConnectTimeout() {
|
|
90
|
+
return config.optInt("connectTimeout", 10000); // Default 10 sec.
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public int getReadTimeout() {
|
|
94
|
+
return config.optInt("readTimeout", 10000); // Default 10 sec.
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public int getRetryCount() {
|
|
98
|
+
return config.optInt("retryCount", 10);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
public boolean getShowBuffering() {
|
|
102
|
+
return config.optBoolean("showBuffering");
|
|
103
|
+
}
|
|
104
|
+
}
|