I've been really struggling with getting my channel to work on PHT (only tested on Mac, latest plexpass), despite that it works on Plex/Web and Android.
Long story short, it's probably best to just show my code and some examples and kindly ask if someone would like to take a look at it. I've tried so many variants now with both direct aac and mp3 streams and now finally using HLS.
Here is my URL service code:
LIVE_URL_JSON = 'http://v7.psapi.nrk.no/mediaelement/%s' LIVE_RADIO_BASEURL = 'http://radio.nrk.no/direkte/'def MetadataObjectForURL(url):
Log.Debug(‘NRK: MetadataObjectForURL called for %s’ % url)
channel = url.replace(LIVE_RADIO_BASEURL,‘’)
audio_json = JSON.ObjectFromURL(LIVE_URL_JSON % channel, headers={‘User-Agent’:‘Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25’})
return TrackObject(
title = audio_json[‘title’],
summary = audio_json[‘description’],
thumb = “”)def MediaObjectsForURL(url):
Log.Debug("NRK: Adding media object for live radio stream: " + url)
channel = url.replace(LIVE_RADIO_BASEURL,‘’)
audio_url = JSON.ObjectFromURL(LIVE_URL_JSON % channel, headers={‘User-Agent’:‘Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25’})[‘mediaUrl’]
Log.Debug(‘NRK: Found audio url %s’ % audio_url )
mobjects =
liveurl = (audio_url)
mobjects.append(MediaObject(
parts = [PartObject(key=HTTPLiveStreamURL(liveurl))],
optimized_for_streaming = True,
audio_channels = 2))
return mobjects
This is a result of testing my url service: lookup-test.xml (972 Bytes)
And here is the m3u8 I'm currently working with: master.m3u8.txt (592 Bytes)
For the MediaObject, I've tried setting many parameters manually, such as audio_codec and container, with and without HTTPLiveStreamURL etc.
The log from PHT repeats a lot of when trying to play an item
14:19:06 T:4462026752 NOTICE: Thread MediaDecision start, auto delete: false
14:19:06 T:140735166722432 ERROR: CAudioDecoder: Unable to Init Codec while loading file http://nrkradio-f.akamaihd.net/i/ostlandssendingen_0@4273/master.m3u814:19:06 T:140735166722432 WARNING: PAPlayer::QueueNextFileEx - Failed to create the decoder
I'm out of alternatives and suggetions, maybe someone here can take a quick look?
The log of commits in the liveradio branch show some stuff I've already tried.