Giter Club home page Giter Club logo

cordova-plugin-exoplayer's Introduction

MIT License Build Status Code Climate Donate

Cordova ExoPlayer Plugin

Cordova media player plugin using Google's ExoPlayer framework.

Please send us links to your cool projects made with this plugin so we can include them on this page!

Keeping track of exoplayer versions here:

plugin exoplayer
2.6.0 2.18.1
2.5.7 2.18.1
2.5.6 2.9.6
2.5.5 2.8.1
2.5.4 2.6.1

Changes in version 2.6.0

Add alternative constructor to allow creation of player without Android UI

  • New feature, hence change in package minor version Fix crash at playback start

Changes in version 2.5.7

Upgrade exoplayer to 2.18.1 Merge changes from netmikey fork

  • Various updates needed to remove SimpleExoPlayer

Changin in version 2.5.6

Upgraded exoplayer to 2.9.6

Upgrading to following versions is now possible cordova: 11.0.0 (latest) cordova-android: ^9.1.0

Changes in version 2.5.4

  • 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.
  • Added ability to change text, buttons and buffering colors using new controller configuration settings textColor, buttonsColor and bufferingColor.
  • Added positionInFirstPeriod to TIMELINE_EVENT.
  • Upgraded exoplayer to 2.6.1.

Changes in version 2.5.3

  • After observing performance issues removing the usage of okhttp.
  • Removing the 'android.hardware.touchscreen' check before adding touch handler. This feature is not reliably reported by various devices.

Changes in version 2.5.2

  • Upgraded exoplayer to version 2.5.1
  • Only adding touchscreen event handler if device has "android.hardware.touchscreen" system feature.
  • Added connectTimeout, readTimeout and retryCount configuration settings. These are related to http client player uses.
  • Added seekBy which is simmilar to seekTo but operates relative to the current possition. Value can be positive (seek forward) or negative (seek backwards).

Changes in version 2.5.1

  • 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.
  • Added autoPlay (defaults to true) to allow user not to play the stream automatically. Must call play explicitly.

Changes in version 2.5.0

  • Removed configuration setting skipTime and replaced it with separate forwardTime and rewindTime.
  • Sending TIMELINE_EVENT to Cordova with periodDurationX and periodWindowPositionX properties for duration and window position for each period (marked X) in the stream.

Changes in version 2.4.5

  • 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.

Changes in version 2.4.4

  • 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.

Changes in version 2.4.2

  • Plugin no longer acts on audio focus event but rather let's Cordova app decide what to do.

Changes in version 2.4.1

  • When audio focus changes, plugin will send AUDIO_FOCUS_EVENT with parameter audioFocus that can be on of: AUDIOFOCUS_LOSS_TRANSIENT, AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK, AUDIOFOCUS_GAIN, AUDIOFOCUS_LOSS.

Changes in version 2.4.0

  • Controller will no longer show automatically on touch and key events.
  • Added showController and hideController methods for explicit control of controller visibility.
  • Plugin will not longer close on KEYCODE_BACK key event, please call .close() explicitly.
  • 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.
  • START_EVENT will return additional info audioFocus which can be AUDIOFOCUS_REQUEST_FAILED or AUDIOFOCUS_REQUEST_GRANTED.
  • STATE_EVENT will return additional info controllerVisible to tell the app if controller is visible or not.

Changes in version 2.3.0

  • Renamed plugin's namespace from window.exoplayer to window.ExoPlayer
  • Removed init method as there is no need to keep instance of the plugin around. Just call methods directly on window.ExoPlayer
  • show now takes configuration parameters as the first argumeent since we don't need init any more.
  • Renamed playOffset configuration setting to seekTo to match the coresponding method that does the same thing
  • Replaced play and pause methods with single playPause that does both and keeps track of playback status

Using

Create a new Cordova Project

$ cordova create hello com.example.helloapp Hello

Install the plugin

$ cd hello
$ cordova plugin add cordova-plugin-exoplayer

Edit www/js/index.js and add the following code inside onDeviceReady

    var successCallback = function(json) {
    };

    var errorCallback = function(error) {
    };

    var params = {
        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"
    };

    window.ExoPlayer.show(parameters, successCallback, errorCallback);

Plugin methods exported via window.ExoPlayer

{
    setStream(url, controllerConfig) // switch stream without disposing of the player. controllerConfig is "controller" part of the inital parameters.
    playPause() // will pause if playing and play if paused :-)
    stop() // will stop the current stream
    seekTo(milliseconds) // jump to particular poing into the stream
    getState(successCallback, errorCallback) // returns player state
    showController() // shows player controller
    hideController() // hides player controller
    setController() // sets `controller` part of configuration related to the info bar and control buttons.
    close() // close and dispose of player, very important to call this method when your app exits!
}

This is what parameters look like for the show call, most of them are optional:

{
    url: 'https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8',
    userAgent: 'MyAwesomePlayer', // default is 'ExoPlayerPlugin'
    aspectRatio: 'FILL_SCREEN', // default is FIT_SCREEN
    hideTimeout: 5000, // Hide controls after this many milliseconds, default is 5 sec
    autoPlay: true, // When set to false stream will not automatically start
    seekTo: 10 * 60 * 60 * 1000, // Start playback 10 minutes into video specified in ms, default is 0
    forwardTime: 60 * 1000, // Amount of time in ms to use when skipping forward, default is 1 min
    rewindTime: 60 * 1000, // Amount of time in ms to use when skipping backward, default is 1 min
    audioOnly: true, // Only play audio in the backgroud, default is false
    subtitleUrl: 'http://url.to/subtitle.srt', // Optional subtitle url
    connectTimeout: 1000, // http connect timeout in ms (default is 0)
    readTimeout: 1000, // http read timeout in ms (default is 0)
    retryCount: 5, // Number of times datasource will retry the stream before giving up (default is 3)
    showBuffering: true, // When buffering, player will show indicator at the top of the screen, default is false
    controller: { // If this object is not present controller will not be visible
        streamImage: 'http://url.to/channel.png',
        streamTitle: 'Cool channel / movie',
        streamDescription: '2nd line you can use to display whatever you want like current program epg or movie description',
        hideProgress: true, // Hide entire progress timebar
        hidePosition: false, // If timebar is visible hide current position from it
        hideDuration: false, // If timebar is visible Hide stream duration from it
        controlIcons: {
            'exo_rew': null, // Set to null to remove the button from the player
            'exo_play': 'http://url.to/play.png',
            'exo_pause': 'http://url.to/pause.png',
            //'exo_ffwd': null, // Buttons not included in configuration will show up as default ExoPlayer buttons
        },
        textColor: '#ffff0000', // These colors can be any valid Android color
        buttonsColor: '#ff00ff00', // This example uses hex values including alpha (first byte)
        bufferingColor: '#ff0000ff' // Alpha of 'ff' makes it 100% opaque
    }
}

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.

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.

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.

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.

If you want to show default control buttons (play/pause, rewind, forward) you need an empty controlIncons object:

    controlIcons: {
    }

Plugin will send following events back to Cordova app through successCallback specified through show function:

START_EVENT
STOP_EVENT
KEY_EVENT
TOUCH_EVENT
LOADING_EVENT
STATE_CHANGED_EVENT
POSITION_DISCONTINUITY_EVENT
SEEK_EVENT
PLAYER_ERROR_EVENT
TIMELINE_EVENT

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.

Example of key events:

{
    'eventType':'KEY_EVENT',
    'eventAction':'ACTION_DOWN',
    'eventKeycode':'KEYCODE_VOLUME_UP'
}

{
    'eventType':'KEY_EVENT',
    'eventAction':'ACTION_UP',
    'eventKeycode':'KEYCODE_VOLUME_UP'
}

Example of touch events:

{
    'eventType':'TOUCH_EVENT',
    'eventAction':'ACTION_DOWN',
    'eventAxisX':543,
    'eventAxisY':1321.8009033203125
}

{
    'eventType':'TOUCH_EVENT',
    'eventAction':'ACTION_MOVE',
    'eventAxisX':543,
    'eventAxisY':1320.5
}

{
    'eventType':'TOUCH_EVENT',
    'eventAction':'ACTION_UP',
    'eventAxisX':543,
    'eventAxisY':1320.5
}

Install Android platform

cordova platform add android

Run the code

cordova run

IONIC

For examples of using this plugin in an IONIC app please see this thread.

For IONIC Native see npm module.

Contributing

  1. Fork it
  2. Create your feature branch off of current upstram branch (currently 2.0.0)
  3. Commit and push your changes to that branch
  4. Create new Pull Request

More Info

For more information on setting up Cordova see the documentation

For more info on plugins see the Plugin Development Guide

General ExoPlayer documentation

ExoPlayer source code https://github.com/frontyard/cordova-plugin-exoplayer

Donation

If this project helps you consider donating to support it!

paypal

License

The MIT License (MIT)

Copyright (c) 2017-2018 Nedim Cholich

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

cordova-plugin-exoplayer's People

Contributors

adjulbic avatar devcer avatar frontyard avatar hitaloramon avatar mike-tempest avatar netmikey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-plugin-exoplayer's Issues

Player can't go back and Displaying a mini player bar

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 .

Problem with starting

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

Image

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

cordova build compile error

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"

Add package.json file (and ideally upload to npm)

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 to add a back button

In the video player interface, how to add a return button to return to the previous page, thank you

MKV video no audio

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

Execution failed for task ':transformDexArchiveWithExternalLibsDexMergerForDebug'.

Hi,

When i build my app after install this plugin, I get this error:


(...)
:compileDebugSources
:transformClassesWithDexBuilderForDebug

:transformDexArchiveWithExternalLibsDexMergerForDebug
FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':transformDexArchiveWithExternalLibsDexMergerForDebug'.

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.

  • What went wrong:
    Execution failed for task ':transformDexArchiveWithExternalLibsDexMergerForDebug'.

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

Player stops playing in background on some devices

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?

App crash after play / stop a couple of times

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?

Donation

Hi @frontyard,
Thank you for all supports.
I can not find donation way for you.
How can I donate?
Best Regards
mkalyon

Wrong metadata causes error on cordova prepare

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?

Exo player crashing with Ionic

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.

Player keeps playing on incoming call: any advice?

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.

Controlling the player volume

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?

player controller does not view

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.

How to detect if player is null

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

Video with specific height and width

Hello.
Is it possible to use the exoplayer as an element in html (Or to )?
I created a cordova app and for now I am using video html tag to play inline video with specific height and width.

Thank you.

cordovaappscreenshot

Regain a player handle after page reloading

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?

how do to pass flags like FLAG_ALLOW_NON_IDR_KEYFRAMES

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

Allow enable/disable of subtitles through player's 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.

Cannot install this plugin

I was getting the following error when i was running the ionic 2 example listed herehttps://github.com/spyderboy/ionic2Exoplayer
exoplayer

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?
exo-error

$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

Demo code.

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

Not playing m3u8 files

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) }) }

Chromecast Suport

@frontyard

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.

Fullscreen without virtual buttons

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?

HTML overlay layer ?

Does it posible to have HTML overlay layer over exoplayer playback ?
For example to show menu or EPG data.

Exoplayer is not closing

I've added a backbutton eventlistener to close the exoplayer, but it does not close.

Can you help me?

Hide player during playback

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.

Build error for 2.5.4

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.

add methods to show/hide controls

It would be nice to add methods to be able to show/hide control on event raising.
For example touch anywhere should hide controls.

EventListeners interfere with playback framerate

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?

Close plugin after player closing

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.

Problem installing plugin.

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

Playlist adding

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

Exoplayer+ ionic

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.