Exemplo n.º 1
0
 private async void ReportPlaybackStopped(uBaseObject mediaInfo, StreamParams streamInfo, long?positionTicks)
 {
     try
     {
         await _sessionManager.OnPlaybackStopped(new PlaybackStopInfo
         {
             ItemId        = streamInfo.ItemId,
             SessionId     = _session.Id,
             PositionTicks = positionTicks,
             MediaSourceId = streamInfo.MediaSourceId
         }).ConfigureAwait(false);
     }
     catch (Exception ex)
     {
         _logger.ErrorException("Error reporting progress", ex);
     }
 }
Exemplo n.º 2
0
        private void OnPlaybackProgress(uBaseObject mediaInfo)
        {
            var mediaUrl = mediaInfo.Url;

            if (string.IsNullOrWhiteSpace(mediaUrl))
            {
                return;
            }

            if (PlaybackProgress != null)
            {
                PlaybackProgress.Invoke(this, new PlaybackProgressEventArgs
                {
                    MediaInfo = mediaInfo
                });
            }
        }
Exemplo n.º 3
0
        private PlaybackStartInfo GetProgressInfo(uBaseObject mediaInfo, StreamParams info)
        {
            return(new PlaybackStartInfo
            {
                ItemId = info.ItemId,
                SessionId = _session.Id,
                PositionTicks = GetProgressPositionTicks(mediaInfo, info),
                IsMuted = _device.IsMuted,
                IsPaused = _device.IsPaused,
                MediaSourceId = info.MediaSourceId,
                AudioStreamIndex = info.AudioStreamIndex,
                SubtitleStreamIndex = info.SubtitleStreamIndex,
                VolumeLevel = _device.Volume,

                // TODO
                CanSeek = true,

                PlayMethod = info.IsDirectStream ? PlayMethod.DirectStream : PlayMethod.Transcode
            });
        }