Exemplo n.º 1
0
 private static void ParsePlayerData(JsonPlayerResponse data, List <VideoData> videoTypes)
 {
     // TODO
 }
Exemplo n.º 2
0
        private static R <PlayResource, LocalStr> ParseLiveData(AudioResource resource, JsonPlayerResponse parsed)
        {
            var webListResponse = WebWrapper.GetResponse(new Uri(parsed.streamingData.hlsManifestUrl), response =>
            {
                return(AudioTags.M3uReader.TryGetData(response.GetResponseStream()).OkOr(null));
            });

            if (webListResponse.Ok)
            {
                const string AacHe = "mp4a.40.5";
                const string AacLc = "mp4a.40.2";

                var webList    = webListResponse.Value;
                var streamPref = from item in webList
                                 let codecs = item.StreamMeta != null?StreamCodecMatch.Match(item.StreamMeta).Groups[1].Value : ""
                                              let codecPref = codecs.Contains(AacLc) ? 0
                                                                                                                                                                         : codecs.Contains(AacHe) ? 1
                                                                                                                                                                         : 2
                                                              let bitrate = item.StreamMeta != null?int.Parse(StreamBitrateMatch.Match(item.StreamMeta).Groups[1].Value) : int.MaxValue
                                                                            orderby codecPref, bitrate ascending
                select item;

                var streamSelect = streamPref.FirstOrDefault();
                if (streamSelect != null)
                {
                    if (resource.ResourceTitle == null)
                    {
                        resource = resource.WithTitle(StringNormalize.Normalize(parsed.videoDetails.title));
                    }
                    return(new PlayResource(streamSelect.TrackUrl, resource));
                }
            }
            return(new LocalStr(strings.error_media_no_stream_extracted));
        }