コード例 #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (int)Rev;
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Uri != null ? Uri.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StreamingUri != null ? StreamingUri.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Nodes != null ? Nodes.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (NodesExt != null ? NodesExt.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (NodeLocator != null ? NodeLocator.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Uuid != null ? Uuid.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Ddocs != null ? Ddocs.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (VBucketServerMap != null ? VBucketServerMap.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BucketCapabilitiesVer != null ? BucketCapabilitiesVer.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BucketCapabilities != null ? BucketCapabilities.GetHashCode() : 0);
         return(hashCode);
     }
 }
コード例 #2
0
        private void InitializePlayback(StreamingUri itemToPlay)
        {
            if (mediaStreams == null)
            {
                mediaStreams = JsonConvert.DeserializeObject <List <StreamingUri> >(Intent.GetStringExtra("mediaStreams"))
                               .Where(a => a.StreamingUrl.OriginalString.Contains(".mp4")).ToList();
            }

            if (player is null)
            {
                mediaSourceFactory   = new DefaultDataSourceFactory(this, Util.GetUserAgent(this, Application.PackageName));
                trackSelectorFactory = new AdaptiveTrackSelection.Factory();
                var renderersFactory = new DefaultRenderersFactory(this);
                player            = ExoPlayerFactory.NewSimpleInstance(this, renderersFactory, new DefaultTrackSelector(trackSelectorFactory));
                playerView        = FindViewById <PlayerView>(Resource.Id.playerView);
                playerView.Player = player;
                playerView.RequestFocus();
                playerView.SetControllerVisibilityListener(this);
                linksSpinner = FindViewById <AppCompatSpinner>(Resource.Id.linksSpinner);

                player.PlayWhenReady = true;
                playerView.ControllerShowTimeoutMs = 3000;

                if (mediaStreams != null && mediaStreams.Count > 0)
                {
                    var titles = new List <string>()
                    {
                    };
                    mediaStreams.ForEach(a => titles.Add(a.StreamingQuality + " - MP4"));
                    linksSpinner.Adapter       = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, titles);
                    linksSpinner.ItemSelected += LinksSpinner_ItemSelected;
                    linksSpinner.SetSelection(0);
                }
            }
            if (itemToPlay != null)
            {
                player.Prepare(CreateMediaSource(itemToPlay));
                playerView.KeepScreenOn = true;
            }
        }
コード例 #3
0
        private IMediaSource CreateMediaSource(StreamingUri link)
        {
            Android.Net.Uri uri    = Android.Net.Uri.Parse(link.StreamingUrl.OriginalString);
            IMediaSource    source = null;

            if (link.StreamingUrl.OriginalString.Contains(".mpd"))
            {
                source = new DashMediaSource.Factory(new DefaultDashChunkSource.Factory(mediaSourceFactory), mediaSourceFactory)
                         .SetManifestParser(new FilteringManifestParser(new DashManifestParser(), new List <StreamKey>()))
                         .CreateMediaSource(uri);
            }
            if (link.StreamingUrl.OriginalString.Contains(".m3u8"))
            {
                source = new HlsMediaSource.Factory(mediaSourceFactory)
                         .SetPlaylistParserFactory(new DefaultHlsPlaylistParserFactory(new List <StreamKey>()))
                         .CreateMediaSource(uri);
            }
            if (link.StreamingUrl.OriginalString.Contains(".mp4"))
            {
                source = new ExtractorMediaSource.Factory(mediaSourceFactory).CreateMediaSource(uri);
            }
            return(source);
        }