KirovBvulgaru / google-cast-sdk

Automatically exported from code.google.com/p/google-cast-sdk
0 stars 0 forks source link

.m3u8 url gets a Load Error if it contains GET params #132

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

When sending an URL http://myhost.com/playlist.m3u8?somekey=somevalue to a 
custom receiver
I get the following error
[ 18.813s] [cast.receiver.MediaManager] Load metadata error

If the URL is without params http://myhost.com/playlist.m3u8 it works like a 
charm 

Original issue reported on code.google.com by ha...@oz.com on 10 Feb 2014 at 11:24

GoogleCodeExporter commented 8 years ago
Please provide a complete log from the beginning till the end so we can exactly 
see what the player is receiving, etc.

Original comment by anad...@google.com on 10 Feb 2014 at 11:54

GoogleCodeExporter commented 8 years ago
Here are two console log files

hls_with_get_params.txt for:
http://teststream.oz.com/b/P277810_800padenc/new2.m3u8?key=value

hls_without_get_params.txt for:
http://teststream.oz.com/b/P277810_800padenc/new2.m3u8

Original comment by ha...@oz.com on 11 Feb 2014 at 1:04

Attachments:

GoogleCodeExporter commented 8 years ago
There is a bug in your code:

var protocol = null;
var ext = ext = url.split('.').pop();
if (ext === 'm3u8') {
protocol = cast.player.api.CreateHlsStreamingProtocol(window.mediaHost);
} else if (ext === 'mpd') {
protocol = cast.player.api.CreateDashStreamingProtocol(window.mediaHost);
} else if (ext === 'ism/') {
protocol = cast.player.api.CreateSmoothStreamingProtocol(window.mediaHost);
} 

You should follow our sample which uses lastIndexOf:

https://developers.google.com/cast/docs/player

      if (url.lastIndexOf('.m3u8') >= 0) {
// HTTP Live Streaming
        protocol = cast.player.api.CreateHlsStreamingProtocol(host);
      } else if (url.lastIndexOf('.mpd') >= 0) {
// MPEG-DASH
        protocol = cast.player.api.CreateDashStreamingProtocol(host);
      } else if (url.indexOf('.ism/') >= 0) {
// Smooth Streaming
        protocol = cast.player.api.CreateSmoothStreamingProtocol(host);
      }

Original comment by anad...@google.com on 11 Feb 2014 at 2:58

GoogleCodeExporter commented 8 years ago
Thank you, 
The receiver code was from your googlecast examples. 
https://github.com/googlecast/cast-custom-receiver/blob/master/sample_media_rece
iver.html

Original comment by ha...@oz.com on 11 Feb 2014 at 9:38

GoogleCodeExporter commented 8 years ago
I have updated the sample to allow for URLs that have query strings etc.

Original comment by kri...@google.com on 11 Feb 2014 at 3:08