Example #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);
     }
 }
Example #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
                });
            }
        }
Example #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
            });
        }