React-native-track-player: Streaming from icecast on iOS

Created on 28 May 2018  路  4Comments  路  Source: react-native-kit/react-native-track-player

I tried to create a basic stream player on iOS, loading media from:
http://mp3.hitradiort1.c.nmdn.net/rt1nordschwabenwl/livestream.mp3

Content-Type: audio/mpeg

The player is setup correctly, after calling TrackPlayer.play() it returns the following:

YellowBox.js:
playback-state` with no listeners registered.
playback-track-changed` with no listeners registered.
playback-state` with no listeners registered.
playback-error` with no listeners registered.

Does the player supports live streaming out-of-the-box ?

Thanks for answering 馃挌

Most helpful comment

It's working 馃帀
Thanks @moonstruck

Setting NSAppTransportSecurity for the domain mp3.hitradiort1.c.nmdn.net in info.plist was the missing piece.

(There is ability to setup a domain including subdomains via NSIncludesSubdomains)

Before adding NSAppTransportSecurity to info.plist, debug console from xCode was the following the time of the issue:

2018-05-31 00:29:33.059129+0200 AppName[19385:2813239] [] nw_connection_get_connected_socket 83 Connection has no connected handler
Starting/Resuming playback
2018-05-31 00:29:34.418 [warn][tid:com.facebook.react.TrackPlayerModuleQueue][RCTEventEmitter.m:53] Sending `playback-state` with no listeners registered.
2018-05-31 00:29:34.419129+0200 AppName[19385:2813239] Sending `playback-state` with no listeners registered.
2018-05-31 00:29:34.431712+0200 AppName[19385:2813731] Cannot start load of Task <F93A994D-7DF9-48DC-9BB5-BBF1C93BB1CB>.<1> since it does not conform to ATS policy
2018-05-31 00:29:34.435294+0200 AppName[19385:2813731] Task <F93A994D-7DF9-48DC-9BB5-BBF1C93BB1CB>.<1> finished with error - code: -1022
2018-05-31 00:29:34.443 [warn][tid:main][RCTEventEmitter.m:53] Sending `playback-state` with no listeners registered.
2018-05-31 00:29:34.444674+0200 AppName[19385:2811754] Sending `playback-state` with no listeners registered.
2018-05-31 00:29:34.447 [warn][tid:main][RCTEventEmitter.m:53] Sending `playback-error` with no listeners registered.
2018-05-31 00:29:34.449995+0200 AppName[19385:2811754] Sending `playback-error` with no listeners registered.
2018-05-31 00:29:34.629132+0200 AppName[19385:2813239] [] nw_connection_get_connected_socket 84 Connection has no connected handler
2018-05-31 00:29:35.255739+0200 AppName[19385:2812182] [] nw_connection_get_connected_socket 85 Connection has no connected handler

All 4 comments

react-native-track-player works great with Icecast. Your problem is most probably for http audio source instead of https.
Try whitelisting your domain for http request in NSAppTransportSecurity

For some reason I'm having the same issue. It used to be not a problem at all, but I cannot play IceCast only in iOS today. Tried both simulator and a device; tried 0.2.2, 0.2.3, 0.2.4; tried HTTPS...but seems that the issue is present. I see the following log in my XCode:

nw_connection_get_connected_socket 17 Connection has no connected handler

(Adding an Environment Var OS_ACTIVITY_MODE=disable didn't help though a quick online search suggested to do this)

Also, if I print out the player handler -

'handler', '{"type":"playback-error","error":"The operation couldn鈥檛 be completed. (RNTrackPlayer.AudioPlayerError error 0.)"}'

is the error data.

Any suggestion would be appreciated.

@SatoshiInoue Oh interesting, this is the same issue I'm having. My issue may provide more clarity on why you're running into this problem on iOS only: https://github.com/react-native-kit/react-native-track-player/issues/207

It's working 馃帀
Thanks @moonstruck

Setting NSAppTransportSecurity for the domain mp3.hitradiort1.c.nmdn.net in info.plist was the missing piece.

(There is ability to setup a domain including subdomains via NSIncludesSubdomains)

Before adding NSAppTransportSecurity to info.plist, debug console from xCode was the following the time of the issue:

2018-05-31 00:29:33.059129+0200 AppName[19385:2813239] [] nw_connection_get_connected_socket 83 Connection has no connected handler
Starting/Resuming playback
2018-05-31 00:29:34.418 [warn][tid:com.facebook.react.TrackPlayerModuleQueue][RCTEventEmitter.m:53] Sending `playback-state` with no listeners registered.
2018-05-31 00:29:34.419129+0200 AppName[19385:2813239] Sending `playback-state` with no listeners registered.
2018-05-31 00:29:34.431712+0200 AppName[19385:2813731] Cannot start load of Task <F93A994D-7DF9-48DC-9BB5-BBF1C93BB1CB>.<1> since it does not conform to ATS policy
2018-05-31 00:29:34.435294+0200 AppName[19385:2813731] Task <F93A994D-7DF9-48DC-9BB5-BBF1C93BB1CB>.<1> finished with error - code: -1022
2018-05-31 00:29:34.443 [warn][tid:main][RCTEventEmitter.m:53] Sending `playback-state` with no listeners registered.
2018-05-31 00:29:34.444674+0200 AppName[19385:2811754] Sending `playback-state` with no listeners registered.
2018-05-31 00:29:34.447 [warn][tid:main][RCTEventEmitter.m:53] Sending `playback-error` with no listeners registered.
2018-05-31 00:29:34.449995+0200 AppName[19385:2811754] Sending `playback-error` with no listeners registered.
2018-05-31 00:29:34.629132+0200 AppName[19385:2813239] [] nw_connection_get_connected_socket 84 Connection has no connected handler
2018-05-31 00:29:35.255739+0200 AppName[19385:2812182] [] nw_connection_get_connected_socket 85 Connection has no connected handler
Was this page helpful?
0 / 5 - 0 ratings

Related issues

moduval picture moduval  路  4Comments

simenJohnsen picture simenJohnsen  路  3Comments

toooldmohammad picture toooldmohammad  路  3Comments

EhteshamAnwar picture EhteshamAnwar  路  3Comments

sagargheewala picture sagargheewala  路  3Comments