Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
webui: the /play redirector - add more user-agent direct streaming, f…
…ixes #2412

- 'VLC/'
- 'MPlayer '
- 'Lavf/' (ffmpeg, libav)
- shoutcastsource (some media players?)
  • Loading branch information
perexg committed Oct 22, 2014
1 parent 472d1e9 commit 5920665
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/webui/webui.c
Expand Up @@ -1027,10 +1027,24 @@ page_play_path_modify(http_connection_t *hc, const char *path, int *cut)
* For curl, wget and TVHeadend do not send the playlist, stream directly
*/
const char *agent = http_arg_get(&hc->hc_args, "User-Agent");
if (strncasecmp(agent, "curl/", 5) == 0 ||
strncasecmp(agent, "wget/", 5) == 0)
return strdup(path + 5); /* note: skip the /play */
if (strncasecmp(agent, "TVHeadend/", 10) == 0)
int direct = 0;

if (strncasecmp(agent, "VLC/", 4) == 0)
direct = 1;
else if (strncasecmp(agent, "MPlayer ", 8) == 0)
direct = 1;
else if (strncasecmp(agent, "curl/", 5) == 0)
direct = 1;
else if (strncasecmp(agent, "wget/", 5) == 0)
direct = 1;
else if (strncasecmp(agent, "TVHeadend/", 10) == 0)
direct = 1;
else if (strncasecmp(agent, "Lavf/", 5) == 0) /* ffmpeg, libav */
direct = 1;
else if (strstr(agent, "shoutcastsource")) /* some media players */
direct = 1;

if (direct)
return strdup(path + 5); /* note: skip the /play */
return NULL;
}
Expand Down

0 comments on commit 5920665

Please sign in to comment.