52 if (typeof(IriSP.__jsonMetadata) === "undefined") { |
52 if (typeof(IriSP.__jsonMetadata) === "undefined") { |
53 break; |
53 break; |
54 }; |
54 }; |
55 |
55 |
56 |
56 |
|
57 |
57 // the json format is totally illogical |
58 // the json format is totally illogical |
58 opts.streamer = IriSP.__jsonMetadata["medias"][0]["meta"]["item"]["value"]; |
59 //opts.streamer = IriSP.__jsonMetadata["medias"][0]["meta"]["item"]["value"]; |
59 var source = IriSP.__jsonMetadata["medias"][0]["href"]; |
60 //var source = IriSP.__jsonMetadata["medias"][0]["href"]; |
60 |
61 |
61 // the source if a full url but jwplayer wants an url relative to the |
62 // the source if a full url but jwplayer wants an url relative to the |
62 // streamer url, so we've got to remove the common part. |
63 // streamer url, so we've got to remove the common part. |
63 opts.file = source.slice(opts.streamer.length); |
64 //opts.file = source.slice(opts.streamer.length); |
|
65 |
|
66 /* sometimes we get served a file with a wrong path and streamer. |
|
67 as a streamer is of the form rtmp://domain/path/ and the media is |
|
68 the rest, we uglily do this : |
|
69 */ |
|
70 opts.file = ""; |
|
71 opts.streamer = ""; |
|
72 var fullPath = IriSP.__jsonMetadata["medias"][0]["href"]; |
|
73 var pathSplit = fullPath.split('/'); |
|
74 |
|
75 for (var i = 0; i < pathSplit.length; i++) { |
|
76 if (i < 4) { |
|
77 opts.streamer += pathSplit[i] + "/"; |
|
78 } else { |
|
79 opts.file += pathSplit[i]; |
|
80 /* omit the last slash if we're on the last element */ |
|
81 if (i < pathSplit.length - 1) |
|
82 opts.file += "/"; |
|
83 } |
|
84 } |
|
85 |
64 } else { |
86 } else { |
65 /* other providers type, video for instance - |
87 /* other providers type, video for instance - |
66 pass everything as is */ |
88 pass everything as is */ |
67 } |
89 } |
68 |
90 |