Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

NEWBIE - Playing audio content on iOS devices

MaestroJALMaestroJAL Members, Plex Pass Posts: 206 Plex Pass

Hello Gurus,

I'm not much of a coder but I can follow the logic of code decently and I'm fairly ok at troubleshooting issues. I've been trying to update some channels that seem to be abandoned to work with the iOS player. I keep receiving the "Unable to start a playback session" error. Could someone please post a working example of the CreateTrackObject or point me to a post? I've searched the forums but could have missed it. That way I can start with something that works and then I can fool with breaking it. Any help will be greatly appreciated!

Here's what I'm working with on the PlexPod plugin. I already can follow that the url, title, thumb, and summary seem to be correctly associated earlier in the code.

`def CreateTrackObject(url, title, thumb, summary, include_container=False):

if url.endswith('.mp3'):
    container = 'mp3'
    audio_codec = AudioCodec.MP3
else:
    container = Container.MP4
    audio_codec = AudioCodec.AAC

track_object = TrackObject(
    key = Callback(CreateTrackObject, url=url, title=title, thumb=thumb, summary=summary, include_container=True),
    rating_key = url,
    title = title,
    thumb = thumb,
    summary = summary,
    duration = 10000,
    items = [
        MediaObject(
            parts = [
                PartObject(key=url)
            ],
            container = container,
            audio_codec = audio_codec,
            audio_channels = 2
        )
    ]
)

if include_container:
    return ObjectContainer(objects=[track_object])
else:
    return track_object`

Main Server: 2009 Mac Pro - 8 Cores @ 2.93 GHz, 32 GB RAM, Mac OS X 10.12.5

Secondary Server: Seagate Personal Cloud

Clients: iOS, PlexWeb, & Roku

Sign In or Register to comment.