Giter Site home page Giter Site logo

rolamix / cordova-plugin-playlist Goto Github PK

View Code? Open in Web Editor NEW
32.0 32.0 32.0 454 KB

๐ŸŽถ A Cordova plugin for Android and iOS with native support for audio playlists, background support, and lock screen controls ๐ŸŽถ

License: MIT License

Java 38.11% Objective-C 32.98% JavaScript 14.52% TypeScript 14.39%
android audio audio-playlists background-playback cordova-plugin exoplayer lockscreen playback playlist

cordova-plugin-playlist's People

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cordova-plugin-playlist's Issues

Capacitor plugin playlist

@codinronan first of all i really wanna thank you from the bottom of my heart for this wonderful plugin it made a app possible 3 year ago which i would not have managed without this plugin!!!

Now i refactored the app to be based on capacitor instead of cordova, and decided to create a cordova plugin based on your amazing work.

Since I got good help with the migration of the objc to swift and was abled to get the android and a new web implementation working, we would like to give this also back to this community

https://github.com/phiamo/capacitor-plugin-playlist/

Delete playlist item using track ID causes crash (iOS)

Expected Behaviour

Deleting a playlist item (using removeItem) or items (using removeItems) should be possible using the playlist track ID.

Actual Behaviour

Terminates with uncaught exception

screen shot 2018-08-11 at 19 57 04

Reproduce Scenario (including but not limited to)

iOS with Ionic, streaming tracks from SoundCloud using SoundCloud stream URLs

Steps to Reproduce

Following the setup in the examples folder, try using this.cdvAudioPlayer.removeItem({trackId: 'some_track_id'});

Platform and Version

iOS 11.4

Cordova CLI version and cordova platform version

Cordova CLI version 7.1.0

Logs taken while reproducing problem

2018-08-11 19:56:57.644256+0100 GigLicker[6596:2275910] Delete track with playlist ID 34639234-317475-7235730-429476049
2018-08-11 19:56:57.646593+0100 GigLicker[6596:2275910] RmxAudioPlayer.execute=removeItem, 34639234-317475-7235730-429476049, <null>
2018-08-11 19:56:57.646691+0100 GigLicker[6596:2275910] -[NSNull integerValue]: unrecognized selector sent to instance 0x1b5b9b878
2018-08-11 19:56:57.648442+0100 GigLicker[6596:2275910] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull integerValue]: unrecognized selector sent to instance 0x1b5b9b878'
*** First throw call stack:
(0x183566d8c 0x1827205ec 0x183574098 0x18356c5c8 0x18345241c 0x104fd64c8 0x104fd3b90 0x104ff2f84 0x104e9ae54 0x104e9acb8 0x104e9c898 0x193273a2c 0x193210734 0x1932128a4 0x192f79d18 0x1931b920c 0x192f3ccfc 0x192f3f704 0x18ab9e17c 0x18ab9e3ec 0x18350f404 0x18350ec2c 0x18350c79c 0x18342cda8 0x185412020 0x18d44c758 0x104e919a0 0x182ebdfc0)
libc++abi.dylib: terminating with uncaught exception of type NSException

(lldb) frame variable
(RmxAudioPlayer *) self = 0x00000001c02c1d50
(SEL) _cmd = "removeItemWithValues:trackId:"
(NSNull *) trackIndex = 0x00000001b5b9b878 class name = NSNull
(__NSCFString *) trackId = 0x00000001c0872400 @"34639234-317475-7235730-429476049"

Note that the value of trackIndex is NSNull, as opposed to nil. The code in RmxAudioPlayer.m is specifically looking for nil to protect against an illegal conversion on the following line. Since the check is not defeating NSNull objects, the illegal conversion is exposed, causing the error above

PLAYLIST_COMPLETED not called (tested on iOS only)

Expected Behaviour

When last item in playlist has completed PLAYLIST_COMPLETED should be called.

Actual Behaviour

It is not called.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

I've only tested this on iOS.

Set playlist using setPlaylistItems, call play and let it play until the end.

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

iPhone X, iOS 12

Cordova CLI version and cordova platform version

8.1.2 ([email protected])

Installed platforms:
android 6.2.3
browser 4.1.0
ios 4.4.0
Available platforms:
osx ~4.0.1
windows ~6.0.0

Plugin version

cordova-plugin-playlist 0.6.0 "AudioPlayer"

Sample Push Data Payload

Sample Code that illustrates the problem

Logs taken while reproducing problem

2019-01-28 12:32:10.382879+0100 Mindly[4001:1605081] playbackDuration ==> 29.97696
2019-01-28 12:32:10.383058+0100 Mindly[4001:1605081] MPNowPlayingInfoPropertyElapsedPlaybackTime ==> 29.98025
2019-01-28 12:32:10.383125+0100 Mindly[4001:1605081] title ==> Sunflower (Spider-Man: Into the Spider-Verse)
2019-01-28 12:32:10.383178+0100 Mindly[4001:1605081] MPNowPlayingInfoPropertyPlaybackRate ==> 1
2019-01-28 12:32:10.383221+0100 Mindly[4001:1605081] albumTitle ==> Spider-Man: Into the Spider-Verse (Soundtrack From & Inspired by the Motion Picture)
2019-01-28 12:32:10.383265+0100 Mindly[4001:1605081] artist ==> Post Malone & Swae Lee
2019-01-28 12:32:10.384862+0100 Mindly[4001:1605081] Queue changed current item to: (null)
2019-01-28 12:32:10.384961+0100 Mindly[4001:1605081] New item ID: (null)
2019-01-28 12:32:10.385009+0100 Mindly[4001:1605081] Queue is at end: YES
2019-01-28 12:32:10.389039+0100 Mindly[4001:1605081] RmxAudioPlayer.onStatus: Playback Completed(50) [1445949267]:  [object Object]
2019-01-28 12:32:10.395449+0100 Mindly[4001:1605081] RmxAudioPlayer.onStatus: Playback Position Changed(40) [1445949267]:  [object Object]
2019-01-28 12:32:10.395551+0100 Mindly[4001:1605081] RmxAudioPlayer.onStatus: Track Changed(100) [NONE]:  [object Object]
2019-01-28 12:32:10.408013+0100 Mindly[4001:1605081] RmxAudioPlayer.onStatus: Stopped(60) [INVALID]:
2019-01-28 12:32:10.408138+0100 Mindly[4001:1605081] ERROR: BAIL STATUS UPDATE, NO DATA 60

It seems the callback never fires because _isReplacingItems is true at runtime. What is the purpose of checking for this variable?

WORKAROUND
As a temporary workaround, instead of using setPlaylistItems you can chain clearAllItems and addAllItems:

return this.wrapPromise('clearAllItems', (resolve, reject) => {
	this.instance.clearAllItems(resolve, reject);
}).then(() => this.wrapPromise('addAllItems', (resolve, reject) => {
	this.instance.addAllItems(resolve, reject, tracks);
}));

Doesn't Work At all for me

Expected Behaviour

To work with Angular 6

Actual Behaviour

Doesnt work with angular 6 and Android Studio prints "AAPT ERROR"

Reproduce Scenario (including but not limited to)

Just by running gradle sync post adding this plugin through cordova

Steps to Reproduce

Just by running gradle sync post adding this plugin through cordova

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Android 9.0

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Android Studio Emulator Nexus5X

Cordova CLI version and cordova platform version

cordova --version           8.1.2                         
cordova platform version android       7.1.4              # e.g. 4.1.1

Plugin version

cordova plugin version | grep phonegap-plugin-push   # e.g. 1.5.3

Sample Push Data Payload

Sample Code that illustrates the problem

Logs taken while reproducing problem

Playback crashes when memory usage is high

Expected Behaviour

Audio playback does not crash when device memory usage is high

Actual Behaviour

Playlist is wiped and playback stops when device memory usage is high.

2019-03-16 18:22:12.084697+0000 GigLicker[3207:706217] RmxAudioPlayer.onStatus: Playback Position Changed(40) [36118384-9379924-76370446-326068075]:  [object Object] // last 'normal' message before error
2019-03-16 18:22:12.511812+0000 GigLicker[3207:706217] Queue changed current item to: (null)
2019-03-16 18:22:12.511853+0000 GigLicker[3207:706217] New item ID: (null)
2019-03-16 18:22:12.511870+0000 GigLicker[3207:706217] Queue is at end: YES
2019-03-16 18:22:12.556931+0000 GigLicker[3207:706217] RmxAudioPlayer, removeAllTracks, ==> RMXSTATUS_PLAYLIST_CLEARED
2019-03-16 18:22:12.557050+0000 GigLicker[3207:706217] music-controls-clear
2019-03-16 18:22:12.557065+0000 GigLicker[3207:706217] RmxAudioPlayer, queuePlayerCleared, MEMORY_WARNING
2019-03-16 18:22:12.882796+0000 GigLicker[3207:706217] RmxAudioPlayer.onStatus: Track Removed(115) [34848654-176398-223859742-323062077]:  [object Object]
2019-03-16 18:22:12.932868+0000 GigLicker[3207:706217] Got RmxAudioPlayer onStatus:
2019-03-16 18:22:12.935161+0000 GigLicker[3207:706217] {"type":115,"trackId":"34848654-176398-223859742-323062077","value":{"artist":"The Wurzels","trackId":"34848654-176398-223859742-323062077","isStream":true,"assetUrl":"https://api.soundcloud.com/tracks/323062077/stream","title":"Old Rosie","album":"SoundCloud","albumArt":"https://i1.sndcdn.com/artworks-IBQkaW5WX4bk-0-large.jpg"}}

// ... lots of RMXSTATUS_ITEM_REMOVED statuses while playlist gets wiped ..

2019-03-16 18:22:13.139513+0000 GigLicker[3207:706217] RmxAudioPlayer.onStatus: Track Changed(100) [NONE]:  [object Object]
2019-03-16 18:22:13.139573+0000 GigLicker[3207:706217] Got RmxAudioPlayer onStatus:
2019-03-16 18:22:13.139636+0000 GigLicker[3207:706217] {"type":100,"trackId":"NONE","value":{"currentIndex":9223372036854776000,"currentItem":{},"hasNext":0,"hasPrevious":1,"isAtEnd":true,"isAtBeginning":false}}
2019-03-16 18:22:13.140477+0000 GigLicker[3207:706217] RmxAudioPlayer.onStatus: Stopped(60) [INVALID]:
2019-03-16 18:22:13.140540+0000 GigLicker[3207:706217] Got RmxAudioPlayer onStatus:
2019-03-16 18:22:13.140601+0000 GigLicker[3207:706217] {"type":60,"trackId":"INVALID"}
2019-03-16 18:22:13.140993+0000 GigLicker[3207:706217] RmxAudioPlayer.onStatus: Playlist Cleared(120) [INVALID]:
2019-03-16 18:22:13.141057+0000 GigLicker[3207:706217] Got RmxAudioPlayer onStatus:
2019-03-16 18:22:13.141177+0000 GigLicker[3207:706217] {"type":120,"trackId":"INVALID"}
2019-03-16 18:22:13.141457+0000 GigLicker[3207:706217] RmxAudioPlayer.onStatus: Playlist Cleared(120) [INVALID]:  [object Object]
2019-03-16 18:22:13.141535+0000 GigLicker[3207:706217] Got RmxAudioPlayer onStatus:
2019-03-16 18:22:13.141783+0000 GigLicker[3207:706217] {"type":120,"trackId":"INVALID","value":{"reason":"memory-warning"}}
2019-03-16 18:22:13.156704+0000 GigLicker[3207:706217] RmxAudioPlayer.onStatus: Playback Position Changed(40) [undefined]:
2019-03-16 18:22:13.170345+0000 GigLicker[3207:706217] Error in Success callbackId: RmxAudioPlayer343424179 : TypeError: undefined is not an object (evaluating 'status['value']['currentPosition']')
2019-03-16 18:22:38.104186+0000 GigLicker[3207:706217] Audio session interruption received: NSConcreteNotification 0x281b634b0 {name = AVAudioSessionInterruptionNotification; object = <AVAudioSession: 0x2817394f0>; userInfo = {
    AVAudioSessionInterruptionTypeKey = 1;
}}
2019-03-16 18:22:38.106038+0000 GigLicker[3207:706217] AVAudioSessionInterruptionTypeBegan. Was suspended: 0
2019-03-16 18:22:38.258119+0000 GigLicker[3207:706217] {"line":1,"column":157,"sourceURL":"http://localhost:8080/var/containers/Bundle/Application/6DFCE11D-8A92-47EE-B282-9EB5D1CC6D42/GigLicker.app/www/index.html#/home"}
2019-03-16 18:25:13.533344+0000 GigLicker[3207:706217] [ProcessSuspension] Background task expired while holding WebKit ProcessAssertion (isMainThread? 1).

I found that the message RmxAudioPlayer, queuePlayerCleared, MEMORY_WARNING is logged in the onMemoryWarning method, which presumably is called after the OS issues a warning about high memory usage.

Does anyone know if the OS memory warning is being sent because of low available memory on the device, or because this plugin/app is using up too much memory? I don't see any spikes in the plugin/app memory usage when the error occurs, and I only seem to get the error when my app is in the background. So my guess would be the former - that it's something the OS is doing when memory is low on the device, to free up memory used by background apps. That seems to align with the contents of this article.

If that's the case, maybe it's better not to wipe the playlist when the memory warning is received? That might be controversial, but I rarely see other music-playing apps such as Spotify or SoundCloud stop playing music when my phone is busy, so I have my doubts that those apps do anything drastic with their active playlist when they get this kind of warning.

If anyone has any advice or suggestions to the contrary on this (or to explain to me what obvious thing I'm doing wrong with my memory management!), I'm open to hearing that! :-)

Reproduce Scenario

iOS with Ionic, streaming tracks from SoundCloud using stream URLs

Steps to Reproduce

  • Load several tracks onto the playlist, and start playing one of the songs
  • Put the app into the background
  • Increase the memory usage on the device, e.g. by opening and using many other apps, tabs in browsers etc.
  • In my case, this started happening when device memory usage was over 75% (under 500MB remaining), but very inconsistently even then
  • When the message RmxAudioPlayer, queuePlayerCleared, MEMORY_WARNING appears in the logs, the bug has been reproduced

Platform and Version

iOS 12.1.4

Cordova CLI version and cordova platform version

Cordova CLI version 7.1.0
Cordova iOS version 4.5.4

Plugin version

0.7.1

Not possible to release player

Expected Behaviour

It is not possible to release/close player. I can see there is some code in iOS like for example

RmxAudioPlayer.m

  • (void) release:(CDVInvokedUrlCommand*)command {
    NSLog(@"RmxAudioPlayer.execute=release");

but can not find any hock in RmxAudioPlayer.

Problem is if player is not closed than Music Controls /lock screen controls are locking Audio on iOS even after media playing is completed, and after that no other App can use Audio on iOS. I am expecting this is due to music controls or player is not released. I have to control my App completely to use Audio with other applications.

Actual Behaviour

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

iOS

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Cordova CLI version and cordova platform version

cordova --version                                    # e.g. 6.0.0

10.0.0
cordova platform version android # e.g. 4.1.1
[email protected]

Plugin version

cordova plugin version | grep phonegap-plugin-push   # e.g. 1.5.3

cordova-plugin-playlist 0.9.2 "AudioPlayer"

Sample Push Data Payload

Sample Code that illustrates the problem

Logs taken while reproducing problem

Plugin does not handle streaming errors gracefully

Expected Behaviour

When the HTTP request to stream a playlist track is rejected (i.e. the response is an HTTP 4xx client error), the playlist should handle this gracefully, by continuing on to the next track on the playlist (or the previous track, if the user was skipping backwards through the playlist)

Actual Behaviour

The lockscreen UI indicates that the next track is playing, but no music can be heard. It is possible to work around the issue by skipping back and forwards through the tracks, which can cause the music to start playing again.

Reproduce Scenario (including but not limited to)

iOS with Ionic, streaming tracks from SoundCloud using stream URLs

Steps to Reproduce

Create a playlist with at least two valid streaming tracks. In between the two valid tracks, have another streaming track with URL https://api.soundcloud.com/tracks/274436003/stream?client_id=abcdefg - using an invalid SoundCloud key as shown here will cause an HTTP 401 error, which should be enough to reproduce the error.

Play the first track, and skip forward, or wait for the first track to end. The invalid track will be skipped over, and the lockscreen controls will display track information and playback information suggesting the next valid track is playing, when in fact no music is being played by the device.

Platform and Version

iOS 11.4

Cordova CLI version and cordova platform version

Cordova CLI version 7.1.0

Sample Code that illustrates the problem

  var testUrls = [
    'https://api.soundcloud.com/tracks/274436003/stream?client_id=XXXXXXXXXXXXXXXX',
    'https://api.soundcloud.com/tracks/141418479/stream?client_id=XXXXXXXXXXXXXXXX', // BAD
    'https://api.soundcloud.com/tracks/274436002/stream?client_id=XXXXXXXXXXXXXXXX',
  ];

  var testImgs = [
    'https://i1.sndcdn.com/artworks-000192365267-77o515-large.jpg',
    'https://i1.sndcdn.com/artworks-000192365267-77o515-large.jpg',
    'https://i1.sndcdn.com/artworks-000192365293-cym5e2-large.jpg',
  ];

  this.cdvAudioPlayer.setOptions({ verbose: true, resetStreamOnPause: true }).then(() => {
    this.cdvAudioPlayer.setPlaylistItems([
      // Intersperse good tracks with failures
      { trackId: '12345', assetUrl: testUrls[0], albumArt: testImgs[0], artist: 'Mount Nakara', album: 'Test Files', title: 'Test 1', isStream: true },
      { trackId: 'BAD45', assetUrl: testUrls[1], albumArt: testImgs[1], artist: 'Bad Artist 0', album: 'Invented', title: 'Invent track', isStream: true },
      { trackId: '678900', assetUrl: testUrls[2], albumArt: testImgs[2], artist: 'Mount Nakara', album: 'Test Files', title: 'Test 2', isStream: true },
    ])
    .then(() => {
      this.cdvAudioPlayer.play();
    }).catch((err) => console.log('YourService, cdvAudioPlayer setPlaylistItems error: ', err));
  }).catch((err) => console.log('YourService, cdvAudioPlayer init error: ', err));

Logs taken while reproducing problem

2018-07-09 07:36:06.600152+0100 ionic2-soundcloud[844:177701] Apache Cordova native platform version 4.5.3 is starting.
2018-07-09 07:36:06.600781+0100 ionic2-soundcloud[844:177701] Multi-tasking -> Device: YES, App: YES
2018-07-09 07:36:06.613311+0100 ionic2-soundcloud[844:177701] CDVWKWebViewEngine: trying to inject XHR polyfill
2018-07-09 07:36:06.659921+0100 ionic2-soundcloud[844:177701] CDVWKWebViewEngine will reload WKWebView if required on resume
2018-07-09 07:36:06.660124+0100 ionic2-soundcloud[844:177701] Using Ionic WKWebView
2018-07-09 07:36:06.660696+0100 ionic2-soundcloud[844:177701] [CDVTimer][console] 0.073910ms
2018-07-09 07:36:06.660915+0100 ionic2-soundcloud[844:177701] [CDVTimer][handleopenurl] 0.061035ms
2018-07-09 07:36:06.662662+0100 ionic2-soundcloud[844:177701] [CDVTimer][intentandnavigationfilter] 1.669049ms
2018-07-09 07:36:06.662885+0100 ionic2-soundcloud[844:177701] [CDVTimer][gesturehandler] 0.083923ms
2018-07-09 07:36:06.663615+0100 ionic2-soundcloud[844:177701] [CDVTimer][keyboard] 0.608087ms
2018-07-09 07:36:06.692812+0100 ionic2-soundcloud[844:177701] [CDVTimer][splashscreen] 29.049039ms
2018-07-09 07:36:06.730552+0100 ionic2-soundcloud[844:177701] OPTIONS are 0x2c
2018-07-09 07:36:06.878470+0100 ionic2-soundcloud[844:177701] [CDVTimer][rmxaudioplayer] 185.461998ms
2018-07-09 07:36:06.878547+0100 ionic2-soundcloud[844:177701] [CDVTimer][TotalPluginStartup] 218.008995ms
2018-07-09 07:36:07.308562+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer, queuePlayerCleared
2018-07-09 07:36:07.308627+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer, removeAllTracks, ==> RMXSTATUS_PLAYLIST_CLEARED
2018-07-09 07:36:08.433162+0100 ionic2-soundcloud[844:177701] Ionic Native: deviceready event fired after 676 ms
2018-07-09 07:36:08.433405+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.execute=initialize
2018-07-09 07:36:08.435761+0100 ionic2-soundcloud[844:177701] WARN: Native: tried calling StatusBar.styleDefault, but the StatusBar plugin is not installed.
2018-07-09 07:36:08.435932+0100 ionic2-soundcloud[844:177701] WARN: Install the StatusBar plugin: 'ionic cordova plugin add cordova-plugin-statusbar'
2018-07-09 07:36:08.444792+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:08.446680+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.execute=setOptions, {
    resetStreamOnPause = 1;
    verbose = 1;
}
2018-07-09 07:36:08.447181+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.execute=setOptions, {
    resetStreamOnPause = 1;
    verbose = 1;
}
2018-07-09 07:36:08.459700+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.execute=setPlaylistItems, {
}, (
        {
        album = "Test Files";
        albumArt = "https://i1.sndcdn.com/artworks-000192365267-77o515-large.jpg";
        artist = "Mount Nakara";
        assetUrl = "https://api.soundcloud.com/tracks/274436003/stream?client_id=XXXXXXXXXXXXXXXX";
        isStream = 1;
        title = "Test 1";
        trackId = 12345;
    },
        {
        album = Invented;
        albumArt = "https://i1.sndcdn.com/artworks-000192365267-77o515-large.jpg";
        artist = "Bad Artist 0";
        assetUrl = "https://api.soundcloud.com/tracks/141418479/stream?client_id=XXXXXXXXXXXXXXXX";
        isStream = 1;
        title = "Invent track";
        trackId = BAD45;
    },
        {
        album = "Test Files";
        albumArt = "https://i1.sndcdn.com/artworks-000192365293-cym5e2-large.jpg";
        artist = "Mount Nakara";
        assetUrl = "https://api.soundcloud.com/tracks/274436002/stream?client_id=XXXXXXXXXXXXXXXX";
        isStream = 1;
        title = "Test 2";
        trackId = 678900;
    }
)
2018-07-09 07:36:08.472993+0100 ionic2-soundcloud[844:177808] CredStore - performQuery - Error copying matching creds.  Error=-25300, query={
    class = inet;
    "m_Limit" = "m_LimitAll";
    "r_Attributes" = 1;
    sync = syna;
}
2018-07-09 07:36:08.477733+0100 ionic2-soundcloud[844:177808] CredStore - performQuery - Error copying matching creds.  Error=-25300, query={
    class = inet;
    "m_Limit" = "m_LimitAll";
    "r_Attributes" = 1;
    sync = syna;
}
2018-07-09 07:36:08.481080+0100 ionic2-soundcloud[844:177808] CredStore - performQuery - Error copying matching creds.  Error=-25300, query={
    class = inet;
    "m_Limit" = "m_LimitAll";
    "r_Attributes" = 1;
    sync = syna;
}
2018-07-09 07:36:08.486554+0100 ionic2-soundcloud[844:177808] Queue changed current item to: {
    album = "Test Files";
    albumArt = "https://i1.sndcdn.com/artworks-000192365267-77o515-large.jpg";
    artist = "Mount Nakara";
    assetUrl = "https://api.soundcloud.com/tracks/274436003/stream?client_id=XXXXXXXXXXXXXXXX";
    isStream = 1;
    title = "Test 1";
    trackId = 12345;
}
2018-07-09 07:36:08.487206+0100 ionic2-soundcloud[844:177808] New item ID: 12345
2018-07-09 07:36:08.487256+0100 ionic2-soundcloud[844:177808] Queue is at end: NO
2018-07-09 07:36:08.493986+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Track Added(110) [12345]:  [object Object]
2018-07-09 07:36:08.494171+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:08.511800+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Loading(10) [12345]:
2018-07-09 07:36:08.512070+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:08.512270+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Track Added(110) [BAD45]:  [object Object]
2018-07-09 07:36:08.512401+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:08.512482+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Loading(10) [BAD45]:
2018-07-09 07:36:08.512550+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:08.512611+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Track Added(110) [678900]:  [object Object]
2018-07-09 07:36:08.513267+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:08.513558+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Loading(10) [678900]:
2018-07-09 07:36:08.514840+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:08.520177+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Track Changed(100) [12345]:  [object Object]
2018-07-09 07:36:08.520359+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:08.544934+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.execute=play
2018-07-09 07:36:08.548627+0100 ionic2-soundcloud[844:177701] Playback rate changed: 1.000000, is playing: 1
2018-07-09 07:36:08.626764+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Playing(30) [12345]:  [object Object]
2018-07-09 07:36:08.626964+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:11.744435+0100 ionic2-soundcloud[844:177701] The track duration was changed [678900]: 347.585297
2018-07-09 07:36:11.746930+0100 ionic2-soundcloud[844:177701] The track duration was changed [12345]: 275.539581
2018-07-09 07:36:11.798458+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Duration Changed(55) [678900]:  [object Object]
2018-07-09 07:36:11.798589+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:11.798657+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Duration Changed(55) [12345]:  [object Object]
2018-07-09 07:36:11.798719+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:11.823767+0100 ionic2-soundcloud[844:177701]  . . . 0.00000 -> 0.99265 (0.4 %) [12345]
2018-07-09 07:36:11.824301+0100 ionic2-soundcloud[844:177701] PlayerItem status changed to AVPlayerItemStatusReadyToPlay [12345]
2018-07-09 07:36:11.824847+0100 ionic2-soundcloud[844:177701] AVPlayerItemStatusFailed: Error playing audio track: Error playing audio track: (null)
2018-07-09 07:36:11.828996+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Buffering(25) [12345]:  [object Object]
2018-07-09 07:36:11.829150+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:11.829295+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: CanPlay(11) [12345]:  [object Object]
2018-07-09 07:36:11.829398+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:11.829487+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Error(5) [BAD45]:  [object Object]
2018-07-09 07:36:11.829603+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:12.147257+0100 ionic2-soundcloud[844:177701] playbackDuration ==> 0
2018-07-09 07:36:12.147333+0100 ionic2-soundcloud[844:177701] MPNowPlayingInfoPropertyElapsedPlaybackTime ==> 0
2018-07-09 07:36:12.147382+0100 ionic2-soundcloud[844:177701] title ==> Test 1
2018-07-09 07:36:12.147411+0100 ionic2-soundcloud[844:177701] MPNowPlayingInfoPropertyPlaybackRate ==> 1
2018-07-09 07:36:12.147439+0100 ionic2-soundcloud[844:177701] albumTitle ==> Test Files
2018-07-09 07:36:12.147464+0100 ionic2-soundcloud[844:177701] artist ==> Mount Nakara
2018-07-09 07:36:12.148675+0100 ionic2-soundcloud[844:177701] playbackDuration ==> 275.5396
2018-07-09 07:36:12.148805+0100 ionic2-soundcloud[844:177701] MPNowPlayingInfoPropertyElapsedPlaybackTime ==> -0.02937902
2018-07-09 07:36:12.148891+0100 ionic2-soundcloud[844:177701] title ==> Test 1
2018-07-09 07:36:12.148936+0100 ionic2-soundcloud[844:177701] MPNowPlayingInfoPropertyPlaybackRate ==> 1
2018-07-09 07:36:12.148980+0100 ionic2-soundcloud[844:177701] albumTitle ==> Test Files
2018-07-09 07:36:12.149023+0100 ionic2-soundcloud[844:177701] artist ==> Mount Nakara
2018-07-09 07:36:12.160975+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Playback Position Changed(40) [12345]:  [object Object]
2018-07-09 07:36:12.161114+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:12.161204+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Playback Position Changed(40) [12345]:  [object Object]
2018-07-09 07:36:12.161289+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:12.481170+0100 ionic2-soundcloud[844:177701]  . . . 0.00000 -> 15.25551 (5.5 %) [12345]
2018-07-09 07:36:12.484235+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Buffering(25) [12345]:  [object Object]
2018-07-09 07:36:12.484930+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:13.038974+0100 ionic2-soundcloud[844:177701]  . . . 0.00000 -> 146.31184 (53.1 %) [12345]
2018-07-09 07:36:13.049326+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Buffering(25) [12345]:  [object Object]
2018-07-09 07:36:13.049563+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:13.177944+0100 ionic2-soundcloud[844:177701] playbackDuration ==> 275.5396
2018-07-09 07:36:13.178252+0100 ionic2-soundcloud[844:177701] MPNowPlayingInfoPropertyElapsedPlaybackTime ==> -0.02780106
2018-07-09 07:36:13.178860+0100 ionic2-soundcloud[844:177701] title ==> Test 1
2018-07-09 07:36:13.179314+0100 ionic2-soundcloud[844:177701] MPNowPlayingInfoPropertyPlaybackRate ==> 1
2018-07-09 07:36:13.179567+0100 ionic2-soundcloud[844:177701] albumTitle ==> Test Files
2018-07-09 07:36:13.179819+0100 ionic2-soundcloud[844:177701] artist ==> Mount Nakara
2018-07-09 07:36:13.189475+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Playback Position Changed(40) [12345]:  [object Object]
2018-07-09 07:36:13.189811+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:13.621536+0100 ionic2-soundcloud[844:177701]  . . . 0.00000 -> 275.53958 (100.0 %) [12345]
2018-07-09 07:36:13.629885+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Buffering(25) [12345]:  [object Object]
2018-07-09 07:36:13.630295+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:13.630737+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Loaded(15) [12345]:  [object Object]
2018-07-09 07:36:13.631213+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:14.178201+0100 ionic2-soundcloud[844:177701] playbackDuration ==> 275.5396
2018-07-09 07:36:14.178478+0100 ionic2-soundcloud[844:177701] MPNowPlayingInfoPropertyElapsedPlaybackTime ==> 1.003164
2018-07-09 07:36:14.178775+0100 ionic2-soundcloud[844:177701] title ==> Test 1
2018-07-09 07:36:14.178944+0100 ionic2-soundcloud[844:177701] MPNowPlayingInfoPropertyPlaybackRate ==> 1
2018-07-09 07:36:14.179092+0100 ionic2-soundcloud[844:177701] albumTitle ==> Test Files
2018-07-09 07:36:14.179312+0100 ionic2-soundcloud[844:177701] artist ==> Mount Nakara
2018-07-09 07:36:14.208385+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Playback Position Changed(40) [12345]:  [object Object]
2018-07-09 07:36:14.209032+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:15.177759+0100 ionic2-soundcloud[844:177701] playbackDuration ==> 275.5396
2018-07-09 07:36:15.177831+0100 ionic2-soundcloud[844:177701] MPNowPlayingInfoPropertyElapsedPlaybackTime ==> 2.002413
2018-07-09 07:36:15.177878+0100 ionic2-soundcloud[844:177701] title ==> Test 1
2018-07-09 07:36:15.177908+0100 ionic2-soundcloud[844:177701] MPNowPlayingInfoPropertyPlaybackRate ==> 1
2018-07-09 07:36:15.177930+0100 ionic2-soundcloud[844:177701] albumTitle ==> Test Files
2018-07-09 07:36:15.177951+0100 ionic2-soundcloud[844:177701] artist ==> Mount Nakara
2018-07-09 07:36:15.353481+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Playback Position Changed(40) [12345]:  [object Object]
2018-07-09 07:36:15.360951+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:16.177240+0100 ionic2-soundcloud[844:177701] playbackDuration ==> 275.5396
2018-07-09 07:36:16.177485+0100 ionic2-soundcloud[844:177701] MPNowPlayingInfoPropertyElapsedPlaybackTime ==> 3.001105
2018-07-09 07:36:16.177843+0100 ionic2-soundcloud[844:177701] title ==> Test 1
2018-07-09 07:36:16.177874+0100 ionic2-soundcloud[844:177701] MPNowPlayingInfoPropertyPlaybackRate ==> 1
2018-07-09 07:36:16.177897+0100 ionic2-soundcloud[844:177701] albumTitle ==> Test Files
2018-07-09 07:36:16.177938+0100 ionic2-soundcloud[844:177701] artist ==> Mount Nakara
2018-07-09 07:36:16.346792+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Playback Position Changed(40) [12345]:  [object Object]
2018-07-09 07:36:16.351521+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:16.843774+0100 ionic2-soundcloud[844:177701] Queue changed current item to: {
    album = Invented;
    albumArt = "https://i1.sndcdn.com/artworks-000192365267-77o515-large.jpg";
    artist = "Bad Artist 0";
    assetUrl = "https://api.soundcloud.com/tracks/141418479/stream?client_id=XXXXXXXXXXXXXXXX";
    isStream = 1;
    title = "Invent track";
    trackId = BAD45;
}
2018-07-09 07:36:16.843855+0100 ionic2-soundcloud[844:177701] New item ID: BAD45
2018-07-09 07:36:16.843889+0100 ionic2-soundcloud[844:177701] Queue is at end: NO
2018-07-09 07:36:16.843941+0100 ionic2-soundcloud[844:177701] playbackDuration ==> 275.5396
2018-07-09 07:36:16.843970+0100 ionic2-soundcloud[844:177701] MPNowPlayingInfoPropertyElapsedPlaybackTime ==> 4.001124
2018-07-09 07:36:16.845380+0100 ionic2-soundcloud[844:177701] title ==> Test 1
2018-07-09 07:36:16.845634+0100 ionic2-soundcloud[844:177701] MPNowPlayingInfoPropertyPlaybackRate ==> 1
2018-07-09 07:36:16.845682+0100 ionic2-soundcloud[844:177701] albumTitle ==> Test Files
2018-07-09 07:36:16.845727+0100 ionic2-soundcloud[844:177701] artist ==> Mount Nakara
2018-07-09 07:36:16.846518+0100 ionic2-soundcloud[844:177701] music-controls-next
2018-07-09 07:36:16.851723+0100 ionic2-soundcloud[844:177701] playbackDuration ==> 0
2018-07-09 07:36:16.851825+0100 ionic2-soundcloud[844:177701] MPNowPlayingInfoPropertyElapsedPlaybackTime ==> 0
2018-07-09 07:36:16.851871+0100 ionic2-soundcloud[844:177701] title ==> Invent track
2018-07-09 07:36:16.851917+0100 ionic2-soundcloud[844:177701] MPNowPlayingInfoPropertyPlaybackRate ==> 1
2018-07-09 07:36:16.851975+0100 ionic2-soundcloud[844:177701] albumTitle ==> Invented
2018-07-09 07:36:16.852020+0100 ionic2-soundcloud[844:177701] artist ==> Bad Artist 0
2018-07-09 07:36:16.965064+0100 ionic2-soundcloud[844:177701] Queue changed current item to: {
    album = "Test Files";
    albumArt = "https://i1.sndcdn.com/artworks-000192365293-cym5e2-large.jpg";
    artist = "Mount Nakara";
    assetUrl = "https://api.soundcloud.com/tracks/274436002/stream?client_id=XXXXXXXXXXXXXXXX";
    isStream = 1;
    title = "Test 2";
    trackId = 678900;
}
2018-07-09 07:36:16.965149+0100 ionic2-soundcloud[844:177701] New item ID: 678900
2018-07-09 07:36:16.965181+0100 ionic2-soundcloud[844:177701] Queue is at end: YES
2018-07-09 07:36:16.965223+0100 ionic2-soundcloud[844:177701] playbackDuration ==> 0
2018-07-09 07:36:16.965251+0100 ionic2-soundcloud[844:177701] MPNowPlayingInfoPropertyElapsedPlaybackTime ==> 0
2018-07-09 07:36:16.965278+0100 ionic2-soundcloud[844:177701] title ==> Invent track
2018-07-09 07:36:16.965305+0100 ionic2-soundcloud[844:177701] MPNowPlayingInfoPropertyPlaybackRate ==> 1
2018-07-09 07:36:16.967440+0100 ionic2-soundcloud[844:177701] albumTitle ==> Invented
2018-07-09 07:36:16.967526+0100 ionic2-soundcloud[844:177701] artist ==> Bad Artist 0
2018-07-09 07:36:17.083554+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Track Changed(100) [BAD45]:  [object Object]
2018-07-09 07:36:17.090329+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:17.091250+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Skip Forward(90) [BAD45]:  [object Object]
2018-07-09 07:36:17.091916+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-09 07:36:17.092612+0100 ionic2-soundcloud[844:177701] RmxAudioPlayer.onStatus: Playback Position Changed(40) [BAD45]:  [object Object]
2018-07-09 07:36:17.093036+0100 ionic2-soundcloud[844:177701] YourService: Got RmxAudioPlayer onStatus:  [object Object]

Removing track from playlist causes crash

Expected Behaviour

A track can be removed from playlist safely

Actual Behaviour

On some devices, removing a track from the playlist can cause a crash. Plugin crashes with uncaught exception NSInternalInconsistencyException.

After some investigation, it was found that this only seems to happen on old versions of iOS (10.x is affected; 11 and above seems to be ok).

However, there is clearly one place in the code where tracks are being removed from the playlist, without the corresponding observers being removed. So maybe it's possible this issue is being masked somehow in the newer OSes? I'm no expert, but it seems fairly clear to me at what point the observers should be removed (from looking at other parts of the code, like when a new playlist is created and an old one is deallocated).

Reproduce Scenario (including but not limited to)

iOS 10.x with Ionic, streaming tracks

Steps to Reproduce

On a device running iOS 10.x, create a playlist, then try to remove tracks from the playlist

Platform and Version

iOS 10.3

Cordova CLI version and cordova platform version

Cordova CLI version 7.1.0

Plugin version

0.6.0

Logs taken while reproducing problem

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x170298ba0 of class AudioTrack was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x17043ac80> (
<NSKeyValueObservance 0x170259ad0: Observer: 0x1700d5cb0, Key path: status, Options: <New: YES, Old: YES, Prior: NO> Context: 0x1001f4c16, Property: 0x170257790>
<NSKeyValueObservance 0x170257940: Observer: 0x1700d5cb0, Key path: duration, Options: <New: YES, Old: YES, Prior: NO> Context: 0x1001f4c17, Property: 0x170257820>
<NSKeyValueObservance 0x170259aa0: Observer: 0x1700d5cb0, Key path: loadedTimeRanges, Options: <New: YES, Old: YES, Prior: NO> Context: 0x1001f4c18, Property: 0x170257970>

iPhone audio playback is very quiet on the handset speakers; seems to be playing through the wrong speaker

Expected Behaviour

iPhone playback should be through the default audio speaker at a 'normal' volume by default, when no devices are connected to the handset

Actual Behaviour

Playback is extremely quiet, and seems to be playing through the earpiece

Reproduce Scenario (including but not limited to)

iOS with Ionic, listening to tracks from various sources

Steps to Reproduce

Play any kind of track on iPhone, without any devices (e.g. headphones, speakers) connected

Platform and Version

iOS 11.4

Cordova CLI version and cordova platform version

Cordova CLI version 7.1.0

Not working with ionic 4, IOS 13.5

Expected Behaviour

Should play tracks as proposed.

Actual Behaviour

screen and app go blank (black) and app closes immediately upon press of play

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Ionic 4, IOS 13.5

Cordova CLI version and cordova platform version

coerdova 9.0.3

playlist count from N to 1 ๏ผŒ TRACK_CHANGED's data.hasPrevious =1 and data.hasNext = 1

Expected Behaviour

Actual Behaviour

Reproduce Scenario (including but not limited to)

Steps to Reproduce

var playlist = [{ ... },{...}]
player.setPlaylistItems(null,null,playlist);

playlist = [{...}]
player.setPlaylistItems(null,null,playlist);

when fire the first TRACK_CHANGED event , data.currentItem == {}
then, the second TRACK_CHANGED event fire, data.currentItem is current, but
data.hasPrevious =1 and data.hasNext = 1

Platform and Version (eg. Android 5.0 or iOS 9.2.1) iOS 12

(Android) What device vendor (e.g. Samsung, HTC, Sony...) iPhone 7 Plus

Cordova CLI version and cordova platform version

cordova --version                                    # e.g.  the Newest
cordova platform version android                     # e.g. the Newest

Plugin version

cordova plugin version | grep phonegap-plugin-push   # e.g. the Newest

Sample Push Data Payload

Sample Code that illustrates the problem

Logs taken while reproducing problem

music controls are not shown when using cordova-plugin-playlist plugin

Expected Behaviour

music controls are shown to control start, stop, next and previous of the songs.

Actual Behaviour

music controls are not shown

Reproduce Scenario (including but not limited to)

play a mp4 music, then the music is playing at background, without controls displaying.

Steps to Reproduce

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

ios 12.4.1

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Cordova CLI version and cordova platform version

cordova --version                                    7.1.0
cordova platform version ios                    ios 4.5.5

Plugin version

cordova plugin version | grep phonegap-plugin-push   # e.g. 1.5.3

Sample Push Data Payload

Sample Code that illustrates the problem

Logs taken while reproducing problem

Small stutter occurs when playing next item in playlist

Expected Behaviour

Play next item in playlist smoothly

Actual Behaviour

Next item in playlist stutters at the beginning

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Load up a playlist and play from beginning (make sure items does not have silent gaps in the beginning, or you won't be able to hear the stutter)

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

iPhone X, iOS 12

Cordova CLI version and cordova platform version

8.1.2 ([email protected])

Installed platforms:
android 6.2.3
browser 4.1.0
ios 4.4.0
Available platforms:
osx ~4.0.1
windows ~6.0.0

Plugin version

cordova-plugin-playlist 0.6.0 "AudioPlayer"

Sample Push Data Payload

Sample Code that illustrates the problem

Logs taken while reproducing problem

I have some data from verbose option, which shows the currentPosition of the item resetting after a few ms.

image

Ionic4, Cordova 9

Expected Behaviour

To work with Ionic4 and Cordova 9. Any plans / timeline on this? (Good job with the playlist function though! Are you the only one who have done this for Cordova? I can't find any other code...)

Actual Behaviour

Not compiling

Android X Library Support

Currently, android has stopped maintaining the support library, opting to replace it with the Android X library. This has caused issues when building with other plugins that use android x libraries, and unless updated will eventually use deprecated libraries. If you attempt to build the project with android X support enabled, it fails when building.

Reproduce Scenario (including but not limited to)

Build with an app that has Android X Support enabled

Steps to Reproduce

Add the plugin to your cordova project, and then add this code to your cordova project's config to enable Android X support.
<platform name="android"> <preference name="AndroidXEnabled" value="true" /> </platform>
And then build.

Cordova CLI version and cordova platform version

This was done using Cordova v10.0.0 and Cordova-Android v9.0.0

Namely, the plugin uses FloatRange, IntRange, NotNull, and Nullable from the support library.
I've already replaced the code using the support library in my own project, and have created a fork to fix this issue.

Amazing Script!

I'm looking forward to implement it on my project.

One question though, can I install the plugin on top of cordova-media just to provide the background audio capability or it would not work or rather you would suggest a different plugin for this purpose?

Can the script be run using vanilla JS or I would need to use it with Angular or TS (which I am not that familiar at this point)?

Regards

how get native event play/pause ?

Expected Behaviour

AudioPlayer.on('pause', (params) => {
  myContext.pause();
});
AudioPlayer.on('play', (params) => {
  myContext.play();
});

Actual Behaviour

AudioPlayer.on('status', (data) => {});

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Cordova CLI version and cordova platform version

cordova --version                                    # e.g. 6.0.0
cordova platform version android                     # e.g. 4.1.1

Plugin version

cordova plugin version | grep phonegap-plugin-push   # e.g. 1.5.3

Sample Push Data Payload

Sample Code that illustrates the problem

Logs taken while reproducing problem

Can't build cordova platform android 8.0.0

Expected Behaviour

Being able to build Android 8

Actual Behaviour

Build Fails

Steps to Reproduce

Create project with Android 8
Add plugin
Add google-services.json
build project

Cordova CLI version and cordova platform version

cordova (Cordova CLI) : 8.1.2 ([email protected])
Cordova Platforms: android 8.0.0

Plugin version

latest - 0.8.1

Logs taken while reproducing problem

Task :app:processDebugGoogleServices
Parsing json file: /Users/crabbydavis/Freelance/lai/platforms/android/app/google-services.json

Task :app:mergeDebugResources
Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
Task :app:processDebugManifest
Task :app:processDebugResources

Task :app:compileDebugJavaWithJavac
Gradle may disable incremental compilation as the following annotation processors are not incremental: compiler-4.6.1.jar (com.github.bumptech.glide:compiler:4.6.1).
Consider setting the experimental feature flag android.enableSeparateAnnotationProcessing=true in the gradle.properties file to run annotation processing in a separate task and make compilation incremental.
/Users/crabbydavis/Freelance/lai/platforms/android/app/src/main/java/com/rolamix/plugins/audioplayer/playlist/AudioPlaylistHandler.java:176: error: cannot find symbol
notificationProvider != null ? notificationProvider : new PlaylistNotificationProvider(context),
^
symbol: class PlaylistNotificationProvider
location: class Builder<I,M>
where I,M are type-variables:
I extends PlaylistItem declared in class Builder
M extends BasePlaylistManager declared in class Builder
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.
1 error

Task :app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 7s
25 actionable tasks: 7 executed, 18 up-to-date
/Users/crabbydavis/Freelance/lai/platforms/android/gradlew: Command failed with exit code 1 Error output:
/Users/crabbydavis/Freelance/lai/platforms/android/app/src/main/java/com/rolamix/plugins/audioplayer/playlist/AudioPlaylistHandler.java:176: error: cannot find symbol
notificationProvider != null ? notificationProvider : new PlaylistNotificationProvider(context),
^
symbol: class PlaylistNotificationProvider
location: class Builder<I,M>
where I,M are type-variables:
I extends PlaylistItem declared in class Builder
M extends BasePlaylistManager declared in class Builder
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.
1 error

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:compileDebugJavaWithJavac'.

it's not working(android),Build failed with an exception

Actual Behaviour

No voice, no work

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Cordova CLI version and cordova platform version

cordova --version                                   8.1.2 ([email protected])
cordova platform version android                    android 7.1.4

Plugin version

0.8.0

Logs taken while reproducing problem

E/ExoMediaPlayer: Unable to seek across windows, falling back to in-window seeking

Terminating app due to uncaught exception 'NSInternalInconsistencyException'

Expected Behaviour

Actual Behaviour

2019-10-27 21:05:48.945390+0900 YinXi[2355:381881] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unsupported action method signature. Must return MPRemoteCommandHandlerStatus or take a completion handler as the second argument.'
*** First throw call stack:
(0x1841e098c 0x183f090a4 0x1840e2d1c 0x1845188f4 0x19057ef60 0x102a7c570 0x102a75e30 0x102a736c0 0x102a9156c 0x102a60648 0x102a604b0 0x102a62870 0x18b8350e0 0x18b9b8fc4 0x18bb883e4 0x18b6b50e8 0x18b902630 0x18b69f740 0x18b6a2590 0x192d64a6c 0x192d64d2c 0x18415e7e0 0x18415e738 0x18415ded0 0x18415901c 0x1841588bc 0x18dfc4328 0x1881ee6d4 0x102a3c964 0x183fe3460)
libc++abi.dylib: terminating with uncaught exception of type NSException

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

iOS 13.1.2

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Cordova CLI version and cordova platform version

cordova --version                                    # e.g. 6.0.0
cordova platform version android                     # e.g. 4.1.1

Plugin version

cordova plugin version | grep phonegap-plugin-push   # e.g. 1.5.3

Sample Push Data Payload

Sample Code that illustrates the problem

Logs taken while reproducing problem

Low quality audio streaming to Bluetooth devices

Expected Behaviour

Streaming playback from iPhone to a Bluetooth audio device should be high quality, e.g. similar to wired headphones

Actual Behaviour

Streaming audio to certain types of Bluetooth devices is poor quality - the sound is muffled, changing volume can result in an audio 'click' or a brief silence.

Wireless headphones and in-car Bluetooth audio seem to be affected, but Bluetooth speakers do not

Reproduce Scenario

iOS with Ionic, listening to tracks from various sources on a variety of Bluetooth devices: wireless headphones, Bluetooth speakers, in-car audio

Steps to Reproduce

Stream audio to bluetooth headphones/in-car speakers - sound will be low quality, as specified above.

Platform and Version

iOS 11.4

Cordova CLI version and cordova platform version

Cordova CLI version 7.1.0

Searching for track not on playlist causes crash (iOS)

Expected Behaviour

Searching for a trackId that is not on the current playlist should indicate that the track is not present (e.g. could return index -1)

Actual Behaviour

Terminates with uncaught exception

screen shot 2018-08-15 at 12 57 08

Reproduce Scenario (including but not limited to)

iOS with Ionic, streaming tracks

Steps to Reproduce

Add some tracks to a playlist, then try playing one of those tracks using a non-existant trackId, e.g. this.cdvAudioPlayer.playTrackById('1234567890');

Platform and Version

iOS 11.4

Cordova CLI version and cordova platform version

Cordova CLI version 7.1.0

Logs taken while reproducing problem

2018-08-15 12:56:33.947374+0100 GigLicker[9622:3395198] AudioPlayerSuccessCb [setPlaylistItems]:
2018-08-15 12:56:33.947454+0100 GigLicker[9622:3395198] New playlist set
2018-08-15 12:56:33.947509+0100 GigLicker[9622:3395198] RmxAudioPlayer.execute=playTrackById, 1234567890
2018-08-15 12:56:33.948641+0100 GigLicker[9622:3395198] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(0x183566d8c 0x1827205ec 0x1834ff750 0x1834380cc 0x183437f48 0x1030991a4 0x10308fd70 0x1030ae904 0x102f542bc 0x102f54120 0x102f55d9c 0x193273a2c 0x193210734 0x1932128a4 0x192f79d18 0x1931b920c 0x192f3ccfc 0x192f3f704 0x18ab9e17c 0x18ab9e3ec 0x18350f404 0x18350ec2c 0x18350c79c 0x18342cda8 0x185412020 0x18d44c758 0x102f496ec 0x182ebdfc0)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) frame variable
(RmxAudioPlayer *) self = 0x00000001c00d6ff0
(SEL) _cmd = "findTrackById:"
(__NSCFString *) trackId = 0x00000001c42379e0 @"1234567890"
(NSInteger) idx = -1
(AudioTrack *) track = nil

Don't work in iOS with Ionic3.

Don't work in iOS with Ionic3.

Code:

      this.cdvAudioPlayer.setOptions({ verbose: true, resetStreamOnPause: true }).then(() => {
        this.cdvAudioPlayer.setPlaylistItems([
          // Intersperse good tracks with failures
          { trackId: '1', assetUrl: 'http://streaming1.ondamusicalradio.com:8100/omrfmweb', albumArt: '', artist: 'Mount Nakara', album: 'Test Files', title: 'Test 1', isStream: true }
        ])
        .then(() => {
          this.cdvAudioPlayer.play();
        }).catch((err) => console.log('YourService, cdvAudioPlayer setPlaylistItems error: ', err));
      }).catch((err) => console.log('YourService, cdvAudioPlayer init error: ', err));

App open and close instantly.
iOS 13.3.1

Thx

Playback position INFINITY causes plugin crash (iOS)

Expected Behaviour

Plugin should handle assign a 'reasonable' value to the playback position (and playback percentage) when a position of INFINITY is reported (observed before track starts playing).

Actual Behaviour

Terminates with uncaught exception when attempting to write the INFINITY value (assigned to playback percentage) to JSON:

screen shot 2018-07-04 at 23 05 46

Reproduce Scenario (including but not limited to)

iOS with Ionic, streaming tracks from SoundCloud using SoundCloud stream URLs

Steps to Reproduce

Attempt to stream https://api.soundcloud.com/tracks/274436003/stream?client_id=<SOUNDCLOUD_CLIENT_ID> (note: SoundCloud key required - if it's helpful, I will try to reproduce using a streaming track that is publicly accessible)

Platform and Version

iOS 11.4

Cordova CLI version and cordova platform version

Cordova CLI version 7.1.0

Logs taken while reproducing problem

2018-07-05 00:02:20.079333+0100 ionic2-soundcloud[1150:316830] Apache Cordova native platform version 4.5.3 is starting.
2018-07-05 00:02:20.080033+0100 ionic2-soundcloud[1150:316830] Multi-tasking -> Device: YES, App: YES
2018-07-05 00:02:20.091739+0100 ionic2-soundcloud[1150:316830] CDVWKWebViewEngine: trying to inject XHR polyfill
2018-07-05 00:02:20.121938+0100 ionic2-soundcloud[1150:316830] CDVWKWebViewEngine will reload WKWebView if required on resume
2018-07-05 00:02:20.122043+0100 ionic2-soundcloud[1150:316830] Using Ionic WKWebView
2018-07-05 00:02:20.122471+0100 ionic2-soundcloud[1150:316830] [CDVTimer][console] 0.056982ms
2018-07-05 00:02:20.122765+0100 ionic2-soundcloud[1150:316830] [CDVTimer][handleopenurl] 0.187039ms
2018-07-05 00:02:20.124362+0100 ionic2-soundcloud[1150:316830] [CDVTimer][intentandnavigationfilter] 1.539946ms
2018-07-05 00:02:20.124525+0100 ionic2-soundcloud[1150:316830] [CDVTimer][gesturehandler] 0.092983ms
2018-07-05 00:02:20.125317+0100 ionic2-soundcloud[1150:316830] [CDVTimer][keyboard] 0.633001ms
2018-07-05 00:02:20.148291+0100 ionic2-soundcloud[1150:316830] [CDVTimer][splashscreen] 22.867918ms
2018-07-05 00:02:20.237981+0100 ionic2-soundcloud[1150:316830] [CDVTimer][rmxaudioplayer] 89.603066ms
2018-07-05 00:02:20.238063+0100 ionic2-soundcloud[1150:316830] [CDVTimer][TotalPluginStartup] 115.698099ms
2018-07-05 00:02:20.441316+0100 ionic2-soundcloud[1150:316830] RmxAudioPlayer, queuePlayerCleared
2018-07-05 00:02:20.441378+0100 ionic2-soundcloud[1150:316830] RmxAudioPlayer, removeAllTracks, ==> RMXSTATUS_PLAYLIST_CLEARED
2018-07-05 00:02:21.576286+0100 ionic2-soundcloud[1150:316830] Ionic Native: deviceready event fired after 683 ms
2018-07-05 00:02:21.576442+0100 ionic2-soundcloud[1150:316830] RmxAudioPlayer.execute=initialize
2018-07-05 00:02:21.576619+0100 ionic2-soundcloud[1150:316830] WARN: Native: tried calling StatusBar.styleDefault, but the StatusBar plugin is not installed.
2018-07-05 00:02:21.576702+0100 ionic2-soundcloud[1150:316830] WARN: Install the StatusBar plugin: 'ionic cordova plugin add cordova-plugin-statusbar'
2018-07-05 00:02:21.588803+0100 ionic2-soundcloud[1150:316830] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-05 00:02:21.589138+0100 ionic2-soundcloud[1150:316830] RmxAudioPlayer.execute=setOptions, {
    resetStreamOnPause = 1;
    verbose = 1;
}
2018-07-05 00:02:21.589606+0100 ionic2-soundcloud[1150:316830] RmxAudioPlayer.execute=setOptions, {
    resetStreamOnPause = 1;
    verbose = 1;
}
2018-07-05 00:02:21.596359+0100 ionic2-soundcloud[1150:316830] RmxAudioPlayer.execute=setPlaybackVolume, 0.5
2018-07-05 00:02:21.608418+0100 ionic2-soundcloud[1150:316830] RmxAudioPlayer.execute=setPlaylistItems, {
}, (
        {
        album = "Test Files";
        albumArt = "https://i1.sndcdn.com/artworks-000192365267-77o515-large.jpg";
        artist = "Mount Nakara";
        assetUrl = "https://api.soundcloud.com/tracks/274436003/stream?client_id=XXXXXXXXXXXXXXXXXXXX";
        isStream = 1;
        title = "Test 1";
        trackId = 12345;
    }
)
2018-07-05 00:02:21.619147+0100 ionic2-soundcloud[1150:316848] CredStore - performQuery - Error copying matching creds.  Error=-25300, query={
    class = inet;
    "m_Limit" = "m_LimitAll";
    "r_Attributes" = 1;
    sync = syna;
}
2018-07-05 00:02:21.622299+0100 ionic2-soundcloud[1150:316848] Queue changed current item to: {
    album = "Test Files";
    albumArt = "https://i1.sndcdn.com/artworks-000192365267-77o515-large.jpg";
    artist = "Mount Nakara";
    assetUrl = "https://api.soundcloud.com/tracks/274436003/stream?client_id=XXXXXXXXXXXXXXXXXXXX";
    isStream = 1;
    title = "Test 1";
    trackId = 12345;
}
2018-07-05 00:02:21.622364+0100 ionic2-soundcloud[1150:316848] New item ID: 12345
2018-07-05 00:02:21.622474+0100 ionic2-soundcloud[1150:316848] Queue is at end: NO
2018-07-05 00:02:21.629015+0100 ionic2-soundcloud[1150:316830] RmxAudioPlayer.onStatus: Track Added(110) [12345]:  [object Object]
2018-07-05 00:02:21.633461+0100 ionic2-soundcloud[1150:316830] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-05 00:02:21.633907+0100 ionic2-soundcloud[1150:316830] RmxAudioPlayer.onStatus: Loading(10) [12345]:
2018-07-05 00:02:21.634009+0100 ionic2-soundcloud[1150:316830] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-05 00:02:21.651973+0100 ionic2-soundcloud[1150:316830] RmxAudioPlayer.onStatus: Track Changed(100) [12345]:  [object Object]
2018-07-05 00:02:21.652334+0100 ionic2-soundcloud[1150:316830] YourService: Got RmxAudioPlayer onStatus:  [object Object]
2018-07-05 00:02:21.672392+0100 ionic2-soundcloud[1150:316830] RmxAudioPlayer.execute=play
2018-07-05 00:02:21.679928+0100 ionic2-soundcloud[1150:316830] Playback rate changed: 1.000000, is playing: 1
2018-07-05 00:02:21.680610+0100 ionic2-soundcloud[1150:316830] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid number value (infinite) in JSON write'
*** First throw call stack:
(0x181e8ed8c 0x1810485ec 0x181e8ec6c 0x182965c94 0x1829647d4 0x182966b40 0x181db2564 0x18296611c 0x182966b40 0x181d5d3a0 0x18296611c 0x182966b40 0x181d5d3a0 0x18296611c 0x182966e0c 0x181e27f38 0x182966538 0x182964584 0x1829655d4 0x104cff500 0x104d0a0c0 0x104cfef44 0x104cf4780 0x104cef144 0x18281d2f8 0x18281ce30 0x1828a1ca0 0x1878e960c 0x1878f0404 0x1878f0504 0x104cecb80 0x104ce9e74 0x104d08e7c 0x104cc0c80 0x104cc0ae4 0x104cc2760 0x191b92d14 0x191b2fb54 0x191b31cc4 0x191899634 0x191ad86d4 0x19185c618 0x19185f020 0x1894c4148 0x1894c4408 0x181e37404 0x181e36c2c 0x181e3479c 0x181d54da8 0x183d39020 0x18bd71758 0x104cb72d8 0x1817e5fc0)
libc++abi.dylib: terminating with uncaught exception of type NSException

All playlist items begin to buffer all at once, causing large playlists to time out (iOS)

Expected Behaviour

Plugin should successfully load larger playlists of 30+ tracks on iOS

Actual Behaviour

On iOS, loading a large number of tracks (30+) causes a random number of tracks to time out. Loading a smaller subset of the same track list causes no issues.

What I've figured out by logging the requests to my server is that AVQueuePlayer is attempting to buffer all of the tracks all at once, rather than buffering only the current and maybe the next track. When there are 20 or fewer tracks, all of the tracks load and play fine, but when there are 30 or more, the request seems to be too much to handle, and the requests begin to time out before some of the tracks are able to load.

Steps to Reproduce

Add 30+ tracks to the playlist via the setPlaylistItems method on iOS.

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

iOS 10.3.3

Cordova CLI version and cordova platform version

cordova --version                                    7.1.0
cordova platform version ios                    4.5.5

Plugin version

0.6.0

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.