frontyard / cordova-plugin-exoplayer Goto Github PK
View Code? Open in Web Editor NEWMedia player plugin for Cordova that uses Google's ExoPlayer
License: MIT License
Media player plugin for Cordova that uses Google's ExoPlayer
License: MIT License
Hey,
Do you have any working example of this plugin and ionic 3. cannot find any and I'm getting 'Exoplayer' not defined type of errors.
Thanks,
Santosh.
Could I add support for chromecast with Subtitle Submission?
I've been researching the subject and found this playlist:
https://www.youtube.com/playlist?list=PLTK0VPsbaNGpAM-ni5fMJkPeQDpXo_UwK
I think it might help. All the code from this video example is available here:
https://github.com/kunalbhatia/avp/
I would like to be able to help more to make this player look better, but my knowledge in java is not very good lol.
Thanks for everything.
While stress-testing our app, we noticed some strange behaviour from the ExoPlayer plugin: when I continuously stop / play an aac stream, sometimes I end up with the stream playing twice (though I'm sure I explicitly call close()
on the previously running player. Sometimes it seems that a close()
call gets lost, other times it seems that the same stream is started twice in a row (really quickly, so I get some kind of comb filtering effect going...).
When I am in the situation where the player is playing multiple streams at once, a couple of play / stop's more and the app ends up crashing. I managed to capture a stack trace from that crash, I hope this can help:
05-23 21:44:13.318: E/AndroidRuntime(21329): FATAL EXCEPTION: main
05-23 21:44:13.318: E/AndroidRuntime(21329): Process: com.MyPlayer, PID: 21329
05-23 21:44:13.318: E/AndroidRuntime(21329): java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.exoplayer2.SimpleExoPlayer.prepare(com.google.android.exoplayer2.source.MediaSource)' on a null object reference
05-23 21:44:13.318: E/AndroidRuntime(21329): at co.frontyard.cordova.plugin.exoplayer.Player.preparePlayer(Player.java:225)
05-23 21:44:13.318: E/AndroidRuntime(21329): at co.frontyard.cordova.plugin.exoplayer.Player.createPlayer(Player.java:174)
05-23 21:44:13.318: E/AndroidRuntime(21329): at co.frontyard.cordova.plugin.exoplayer.Plugin$1.run(Plugin.java:44)
05-23 21:44:13.318: E/AndroidRuntime(21329): at android.os.Handler.handleCallback(Handler.java:815)
05-23 21:44:13.318: E/AndroidRuntime(21329): at android.os.Handler.dispatchMessage(Handler.java:104)
05-23 21:44:13.318: E/AndroidRuntime(21329): at android.os.Looper.loop(Looper.java:207)
05-23 21:44:13.318: E/AndroidRuntime(21329): at android.app.ActivityThread.main(ActivityThread.java:5728)
05-23 21:44:13.318: E/AndroidRuntime(21329): at java.lang.reflect.Method.invoke(Native Method)
05-23 21:44:13.318: E/AndroidRuntime(21329): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
05-23 21:44:13.318: E/AndroidRuntime(21329): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
As a reference, here's my player-related code (this is TypeScript, but the exoplayer calls should be clear):
private player: any;
public playerPlay(url: string): void {
if (this.player) {
// Dismiss existing player
this.playerStop();
}
// Create new player
this.player = exoplayer.init({
url: url,
audioOnly: true,
});
this.player.show();
}
public playerStop(): void {
if (this.player) {
this.player.close();
this.player = null;
}
}
With this code, I then call playerPlay(someUrl)
a couple of times. As you can see, there should never be more than one player playing at a time. Since JavaScript is single threaded, my wild guess would be a race condition in the Java part of the exoplayer-plugin?
Hey, I am building a IPTV player, and For some reason I cant seem to get exoplayer to play .ts or m3u8 files, I read this could fix a few issues: FLAG_ALLOW_NON_IDR_KEYFRAMES, But how do I add this flags via this plugin? Thanks
Hi @frontyard
Can you add playlist viewing and selecting when play a link.
Thank you
Hi,
If i am calling window.ExoPlayer.getState() after close() then app crashes. So how can i detect that the player is empty/null.
Thanks
I'm using the exoplayer plugin in the audioOnly: true
mode, so I don't show an exoplayer view. I control playback via API calls and get player feedback via the events, just as described in the README.
I have a situation where the player is running in the background and my application triggers an OAuth login. This involves redirecting between pages a couple of times and eventually leads back to my app. Now during this process, the exoplayer keeps playing in the background, which is a good thing as this gives a true "app-like" immersive feeling.
The issue however is that when the webview navigates back to my app after the OAuth redirects, the moment deviceready
fires, I have no way of obtaining the running exoplayer's state. I noticed that when I show()
a new exoplayer, the "old" one stops playing and gets replaced with the new one, which kind of "reconnects" my application to the exoplayer, but it would be way cooler if I could retrieve the player handle something like this (the retrieve()
function is what I'm looking for):
var existingPlayer = exoplayer.retrieve();
if (existingPlayer != null) {
// An exoplayer is running, now we can access its state...
existingPlayer.getState(successCallback, errorCallback);
} else {
// No exoplayer currently running, create a new one...
var player = exoplayer.init({ ... });
player.show();
}
Any chance we could get something like this?
Example project for ionic
Hi @frontyard,
Thank you for all supports.
I can not find donation way for you.
How can I donate?
Best Regards
mkalyon
I use contoller params like that
controller: {
streamImage: 'http://aaa.jpg',
streamTitle: 'my channel',
streamDescription: '.........',
hideProgress: false
}
streamimage and titles are showing.
progress bar is not showing.
play,pause and others are not showing.
Hi, i can place subtitles in VTT or SRT?
I did not see anything about it.
Could you add a Custom Header option?
We can change or select video quality in HLS?
Can we set maximum bitrate in plugin?
Thanks
I got no audio in one MKV video.
They work fine in mxplayer and VLC.
How can I add codecs, libraries or something to make it work.
Thanks
Hello ,
Thanks for this awesome plugin . I have successfully manage to implement it on Ionic 3 , when you click a song the player comes in full screen mode but i am a bit unsure of how to go back as clicking a back button won't allow me to do that . here is my code .
var params = {
url:this.song.data.signed_resource,
userAgent: 'ExoPlayerPlugin',
aspectRatio: 'FIT_SCREEN', // default is FIT_SCREEN
hideTimeout:0, // Hide controls after this many milliseconds, default is 5 sec
seekTo: 0, // Start playback 10 minutes into video specified in milliseconds, default is 0
skipTime: 0, // Amount of time to use when going forward/backward, default is 1 min
controller: { // If this object is not present controller will not be visible
hideProgress: false,
streamImage: `${streamImage}`,
streamTitle: 'my Music',
hidePosition: false, // If timebar is visible hide current position from it
hideDuration: false,
controlIcons: {}
}
}
this.platform.ready().then(() => {
ExoPlayer.show(params);
});
Also , how do i show a mini player bar instead of going to the player full screen mode . Thanks .
Would it be possible to add the ability to set the player volume?
This is useful for setting a preferred initial volume as well as having a possibility to control the volume when audioOnly: true
is set.
Maybe something like:
setVolume(number) // A number between 1 and 100, or a decimal between 0 and 1.
Maybe also add an optional parameter to the init(params)
call?
I tried to install cordova exo player in Ionic-native with Cordova 7.0.0 version, and it cashed.
It says that can't find some files.
Hi,
How can send playlist like that,
{
"url":"url1",
"name":"name1",
"logo":"logo1"
.......
},
{
"url":"url2",
"name":"name2",
"logo":"logo2"
.......
},
......
If not, can u add playlist support.
I can add string array to Player.java and can play next item using KEYCODE_MEDIA_NEXT keycode.
Thanks
We get reports from some users that when their device locks, or goes to sleep (in short: when the app enters the background), the music stops playing after a couple of minutes. As soon as they unlock their device and the app comes back on, it starts buffering and continues playing.
We get this mainly from Samsung users, in one concrete case it is a Samsung Galaxy S6 Edge+. We made sure the user has all energy saver options disabled and we even made him add the app into the battery optimisation whitelist, but nothing seems to help.
Do you have any experience with these kind of issues? Or any hint at what we might do to diagnose exactly why exoplayer stops playing in the background on some devices?
There is any way to see any implementation demo code?
I'm working in a version for Android TV platform. The controls are working properly with remote control keys but they are not working when control panel is hide, and not able to show the control panel by pressing remote control keys. I would like also to control the amount of seconds of the back and forward buttons.
Any help or orientation will be helpful.
Thank you.
FGM
Installing the plugin on the latest Cordova version with the instructions in the README.md
brings up the following error:
$ ../node_modules/.bin/cordova plugin add https://github.com/frontyard/cordova-plugin-exoplayer
Error: Failed to fetch plugin https://github.com/frontyard/cordova-plugin-exoplayer via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 235 Error output:
npm ERR! addLocal Could not install /var/folders/yq/t6hfv8453z5693m7zt4m0qsh0000gn/T/npm-5152-64b122ae/git-cache-65041863/eb052c879ecfc600ddd09510c72f491a821a5fb7
npm ERR! Darwin 16.5.0
npm ERR! argv "/opt/local/bin/node" "/opt/local/bin/npm" "install" "https://github.com/frontyard/cordova-plugin-exoplayer" "--save"
npm ERR! node v6.9.4
npm ERR! npm v3.10.8
npm ERR! code EISDIR
npm ERR! errno -21
npm ERR! syscall read
npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a package.json in
npm ERR! eisdir a package you are trying to install.
Forgive me if I'm getting it wrong, I'm totally new to Cordova, but as far as I understand, this comes from the following change:
As far as I understand, the problem is that fetch is now used by default. [...]
With fetch, plugins now need a package.json since cordova-fetch will npm install the plugin.
https://issues.apache.org/jira/browse/CB-12680
https://issues.apache.org/jira/browse/CB-12685
Finally, it would be very helpful for app developers it you'd provide the plugin via npm :-)
How do I play youtube video?
error msg:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
> Could not find com.google.android.exoplayer:exoplayer:r2.5.1.
Searched in the following locations:
https://repo1.maven.org/maven2/com/google/android/exoplayer/exoplayer/r2.5.1/exoplayer-r2.5.1.pom
https://repo1.maven.org/maven2/com/google/android/exoplayer/exoplayer/r2.5.1/exoplayer-r2.5.1.jar
file:/D:/lzzwork/android/sdk/extras/android/m2repository/com/google/android/exoplayer/exoplayer/r2.5.1/exoplayer-r2.5.1.pom
file:/D:/lzzwork/android/sdk/extras/android/m2repository/com/google/android/exoplayer/exoplayer/r2.5.1/exoplayer-r2.5.1.jar
file:/D:/lzzwork/android/sdk/extras/google/m2repository/com/google/android/exoplayer/exoplayer/r2.5.1/exoplayer-r2.5.1.pom
file:/D:/lzzwork/android/sdk/extras/google/m2repository/com/google/android/exoplayer/exoplayer/r2.5.1/exoplayer-r2.5.1.jar
Required by:
:android:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 20.58 secs
ERROR building one of the platforms: Error code 1 for command: cmd with args: /s,/c,"D:\lzzwork\react_native\cmcsopmn\platforms\android\gradlew cdvBuildDebug -b D:\lzzwork\react_native\cmcsopmn\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
You may not have the required environment or OS to build this project
Error: Error code 1 for command: cmd with args: /s,/c,"D:\lzzwork\react_native\cmcsopmn\platforms\android\gradlew cdvBuildDebug -b D:\lzzwork\react_native\cmcsopmn\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
Hello!
After closing the player via 'close' exec call CordovaPlugin is still opened so I can't go back to point from I've started. Maybe it's normal and I just don't get it. If it's not how can I close the plugin after player was closed too.
Hi,
While buffering how can i display a loading image in the player?
Hi, frontyard!
It's possible add method "hide" for hiding player (with saving playback)? Similarly, the calling of the "show" method with a parameter audioOnly.
Is there any way to add media player controls in notification bar for streaming audio?
It would be nice to add methods to be able to show/hide control on event raising.
For example touch anywhere should hide controls.
Requested by @hitaloramon.
It would be nice if subtitles could be turned on and off from player's control bar. This however has to support both touchscreen and keyboard (for TV remotes) and not affect existing functionality.
This new functionality could trigger new keyboard event and pass it to Cordova just like existing events.
I've added a backbutton eventlistener to close the exoplayer, but it does not close.
Can you help me?
Hi,
I have got error while building.
I use cordova exoplayer plugin version 2.5.4.
Cordova 8.0.0 / Android platform 7.0.0
Error is:
cp: copyFileSync: could not write to dest file (code=ENOENT):C:\cordova7\app\exo1\platforms\android\res\xml\config.xml
Parsing C:\cordova7\app\exo1\platforms\android\res\xml\config.xml failed
(node:3596) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ENOENT: no such file or directory, open 'C:\cordova7\app\exo1\platforms\android\res\xml\config.xml'
Note that there is no problem for old versions.
It would be nice to add methods to control volume : up , down, mute
We get reports from our users that the player doesn't pause/stop playback when the user is in a call. Is that something you'd see in the scope of the exoplayer plugin, or do you have some advice on how I can get notified of an incoming call and stop playback from within my application?
As usual, I'm using the audioOnly mode in the background, without player UI.
I create new project
cordova create hello com.example.helloapp Hello
And add exoplayer plugin
cordova plugin add cordova-plugin-exoplayer
After this I add new platform
cordova platform add android
And I've get error
This is fix if I replace
<asset src="www/ExoPlayer.js" target="js/exoplayer.js"/>
On
<asset src="www/exoplayer.js" target="js/exoplayer.js"/>
in plugin.xml file
Can you add DRM and widevine ???
Does it posible to have HTML overlay layer over exoplayer playback ?
For example to show menu or EPG data.
After lots of debugging, I have discovered the cause of the slow playback of a video. (30fps playing stuttering more like 15fps).
It is caused by the event listeners firing messages to the Web UI component of the plugin. Do we know if there is any way around it? I have been trying to play with different ways, the only way I can get consistent playback is if I comment out the Event Listener overrides.
Is this something anyone else has experienced?
Hi @frontyard,
Please add controller position, background color, font-size, progress bar color and etc. parameters.
Thank you
I met some problem with plugin. When i try to play m3u8 audio files its not playing.My code is like this
$scope.playFMM = function() { var params = { type: "dash", user_agent: "PluginExoPlayer", plugin_controls_visible: true, header: { height: 200, padding: 30, background_color: "#33F0F8FF", image_url: "https://s-media-cache-ak0.pinimg.com/originals/77/7a/df/777adf082fc125aa9490a3450192ec6c.jpg", text_color: "#BBFAA8EF", text_align: "center", text: "Lorem ipsum Ipsum\nlorem Lorem", text_size: 20 }, url: "http://partlive.appscp.com:1935/live/general/playlist.m3u8", full_screen: true, aspect_ratio: "fit_screen", raw_touch_events: false } var player = exoplayer.init(params); player.show(function(success) { console.log("success", success) }, function(err) { console.log("err", err) }) }
I'm not mistaken in the previous version had something to open in fullscreen.
Without the virtual buttons. Was that version removed?
Can you make the player open in fullscreen?
Hi @frontyard,
Could you add forward and rewind plugin method?
Hi,
When i try to install the plugin, I get the next error:
Failed to install 'cordova-plugin-exoplayer': CordovaError: Uh oh!
"/home/jcarlos/Documentos/proyectos_jc/ionic/LacAPPfetera/plugins/cordova-plugin-exoplayer/www/ExoPlayer.js" not found!
at copyFile (/home/jcarlos/Documentos/proyectos_jc/ionic/LacAPPfetera/platforms/android/cordova/lib/pluginHandlers.js:219:36)
at install (/home/jcarlos/Documentos/proyectos_jc/ionic/LacAPPfetera/platforms/android/cordova/lib/pluginHandlers.js:146:13)
at Object.process (/home/jcarlos/Documentos/proyectos_jc/ionic/LacAPPfetera/platforms/android/cordova/node_modules/cordova-common/src/ActionStack.js:56:25)
at PluginManager.doOperation (/home/jcarlos/Documentos/proyectos_jc/ionic/LacAPPfetera/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:114:20)
at PluginManager.addPlugin (/home/jcarlos/Documentos/proyectos_jc/ionic/LacAPPfetera/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:144:17)
at /home/jcarlos/Documentos/proyectos_jc/ionic/LacAPPfetera/platforms/android/cordova/Api.js:243:74
at _fulfilled (/home/jcarlos/Documentos/proyectos_jc/ionic/LacAPPfetera/platforms/android/cordova/node_modules/q/q.js:854:54)
at self.promiseDispatch.done (/home/jcarlos/Documentos/proyectos_jc/ionic/LacAPPfetera/platforms/android/cordova/node_modules/q/q.js:883:30)
at Promise.promise.promiseDispatch (/home/jcarlos/Documentos/proyectos_jc/ionic/LacAPPfetera/platforms/android/cordova/node_modules/q/q.js:816:13)
at /home/jcarlos/Documentos/proyectos_jc/ionic/LacAPPfetera/platforms/android/cordova/node_modules/q/q.js:624:44
(node:19300) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Uh oh!
"/home/jcarlos/Documentos/proyectos_jc/ionic/LacAPPfetera/plugins/cordova-plugin-exoplayer/www/ExoPlayer.js" not found!
There isn't a file called ExoPlayer.js but exoplayer.js, whitout uppercase.
Regards
Hi,
It would be nice to add feature to switch audio track. Some HLS streams embed alternate audio tracks.
Regards
@frontyard
If possible
Can you add playback speed?
Thanks.
It looks like there's something wrong with the metadata the plugin writes to config.xml
/package.json
: when you re-prepare the project from scratch after having added the plugin like so:
cordova plugin add cordova-plugin-exoplayer
rm -rf platforms/ plugins/ node_modules/
cordova prepare
you get the following error:
Failed to restore plugin "co.frontyard.cordova.plugin.exoplayer" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin co.frontyard.cordova.plugin.exoplayer@~2.0.0 via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! Darwin 16.5.0
npm ERR! argv "/opt/local/bin/node" "/opt/local/bin/npm" "install" "co.frontyard.cordova.plugin.exoplayer@~2.0.0"
npm ERR! node v6.9.4
npm ERR! npm v3.10.8
npm ERR! code E404
npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/co.frontyard.cordova.plugin.exoplayer
npm ERR! 404
npm ERR! 404 'co.frontyard.cordova.plugin.exoplayer' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
It looks like co.frontyard.cordova.plugin.exoplayer
has to be replaced with the npm name cordova-plugin-exoplayer
somewhere?
Hi,
When i build my app after install this plugin, I get this error:
(...)
:compileDebugSources
:transformClassesWithDexBuilderForDebug
:transformDexArchiveWithExternalLibsDexMergerForDebug
FAILED
FAILURE: Build failed with an exception.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 6s
39 actionable tasks: 37 executed, 2 up-to-date
(node:21038) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: /home/jcarlos/Documentos/proyectos_jc/ionic/LacAPPfetera/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
FAILURE: Build failed with an exception.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
That's what i get when I run "ionic info"
cli packages: (/usr/lib/node_modules)
@ionic/cli-utils : 1.19.1
ionic (Ionic CLI) : 3.19.1
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.8
Cordova Platforms : android 6.4.0 browser 5.0.3 ios 4.5.3
Ionic Framework : ionic-angular 3.8.0
System:
Android SDK Tools : 26.1.1
Node : v6.12.3
npm : 3.10.10
OS : Linux 4.14
Environment Variables:
ANDROID_HOME : /home/jcarlos/Android/Sdk
Misc:
backend : legacy
Regards
I was getting the following error when i was running the ionic 2 example listed herehttps://github.com/spyderboy/ionic2Exoplayer
So I tried to remove the plugin and add it once again but getting the below error. may i know how can i fix this?
$ionic info gives the following output
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.12.0
ionic (Ionic CLI) : 3.12.0
global packages:
cordova (Cordova CLI) : 7.0.1
local packages:
@ionic/app-scripts : 2.0.2
Cordova Platforms : android 6.2.3
Ionic Framework : ionic-angular 3.5.3
System:
Android SDK Tools : 26.0.2
Node : v8.4.0
npm : 5.4.2
OS : Linux 4.10
Misc:
backend : pro
Hi,
I streamed a remote mp3 file. When the player goes to buffer state it get stuck. It is not returning to the ready state after then. I have to stop the player and again restart.
In the video player interface, how to add a return button to return to the previous page, thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.