Client development: Universal Transcode API help

Hi all,

I’m developing an Android client that supports Plex. Hoping there’s someone here familiar with the universal transcoding API.

The media playback engine I’m using (ExoPlayer), requires the MIME type ahead of time, in order to play HLS streams.

Since the MDE might direct play or return a HLS stream, I’m not able to guess the MIME type.

So, I’m making a HEAD request to the API, gleaning the MIME type from the response headers, and then passing that to the media playback engine, before it makes a GET to retreieve the actual stream.

The problem with this, is making a HEAD request, and then following with a subsequent GET moments later seems to interrupt transcoding, or cause it to fail in some way. I’m not familiar enough with the API or the Plex logs to figure out why this is happening. Perhaps the whole approach is wrong, I’m not sure.

For reference, the full API request looks something like this:

{address}/music/:/transcode/universal/start.m3u8  
?path={path}  
&directStreamAudio=1  
&protocol=hls  
&directPlay=1  
&hasMDE=1  
&download=0  
&X-Plex-Token={accessToken}  
&X-Plex-Client-Identifier={clientIdentifier}  
&X-Plex-Device={deviceName}  
&X-Plex-Session-Identifier={UUID}  
&X-Plex-Client-Profile-Extra=“add-transcode-target(type=musicProfile&context=streaming&protocol=hls&container=mpegts&audioCodec=aac,mp3)”

I’ve come to this set of parameters after a lot of trial and error… Any feedback is welcome.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.