Rolamix / cordova-plugin-playlist

🎶 A Cordova plugin for Android and iOS with native support for audio playlists, background support, and lock screen controls 🎶
MIT License
33 stars 33 forks source link

Playback position INFINITY causes plugin crash (iOS) #4

Closed robinbanbury closed 6 years ago

robinbanbury commented 6 years ago

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
robinbanbury commented 6 years ago

Great work on this plugin by the way!

codinronan commented 6 years ago

Should be fixed with #5 now! :D