Esempio n. 1
0
        public bool Equals(uBaseObject obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }

            return string.Equals(Id, obj.Id);
        }
Esempio n. 2
0
 private async void ReportPlaybackStopped(uBaseObject mediaInfo, StreamParams streamInfo, long?positionTicks)
 {
     try
     {
         await _sessionManager.OnPlaybackStopped(new PlaybackStopInfo
         {
             ItemId        = mediaInfo.Id,
             SessionId     = _session.Id,
             PositionTicks = positionTicks,
             MediaSourceId = streamInfo.MediaSourceId
         }).ConfigureAwait(false);
     }
     catch (Exception ex)
     {
         _logger.ErrorException("Error reporting progress", ex);
     }
 }
Esempio n. 3
0
        private void UpdateMediaInfo(uBaseObject mediaInfo, TRANSPORTSTATE state)
        {
            TransportState = state;

            var previousMediaInfo = _lastMediaInfo;

            _lastMediaInfo = mediaInfo;

            if (previousMediaInfo == null && mediaInfo != null)
            {
                OnPlaybackStart(mediaInfo);
            }
            else if (mediaInfo == null && previousMediaInfo != null)
            {
                OnPlaybackStop(previousMediaInfo);
            }
            else if (mediaInfo != null && mediaInfo.Equals(previousMediaInfo))
            {
                OnPlaybackProgress(mediaInfo);
            }
        }
Esempio n. 4
0
        private PlaybackStartInfo GetProgressInfo(uBaseObject mediaInfo, StreamParams info)
        {
            var ticks = _device.Position.Ticks;

            if (!info.IsDirectStream)
            {
                ticks += info.StartPositionTicks;
            }

            return new PlaybackStartInfo
            {
                ItemId = mediaInfo.Id,
                SessionId = _session.Id,
                PositionTicks = ticks,
                IsMuted = _device.IsMuted,
                IsPaused = _device.IsPaused,
                MediaSourceId = info.MediaSourceId,
                AudioStreamIndex = info.AudioStreamIndex,
                SubtitleStreamIndex = info.SubtitleStreamIndex,
                VolumeLevel = _device.Volume,

                CanSeek = info.MediaSource == null ? _device.Duration.HasValue : info.MediaSource.RunTimeTicks.HasValue,

                PlayMethod = info.IsDirectStream ? PlayMethod.DirectStream : PlayMethod.Transcode,
                QueueableMediaTypes = new List<string> { mediaInfo.MediaType }
            };
        }
Esempio n. 5
0
        private PlaybackStartInfo GetProgressInfo(uBaseObject mediaInfo)
        {
            var info = StreamParams.ParseFromUrl(mediaInfo.Url, _libraryManager);

            return GetProgressInfo(mediaInfo, info);
        }
Esempio n. 6
0
        private async void ReportPlaybackStopped(uBaseObject mediaInfo, StreamParams streamInfo, long? positionTicks)
        {
            try
            {
                await _sessionManager.OnPlaybackStopped(new PlaybackStopInfo
                {
                    ItemId = mediaInfo.Id,
                    SessionId = _session.Id,
                    PositionTicks = positionTicks,
                    MediaSourceId = streamInfo.MediaSourceId

                }).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                _logger.ErrorException("Error reporting progress", ex);
            }
        }
Esempio n. 7
0
File: Device.cs Progetto: Cyrre/Emby
 private void OnPlaybackStop(uBaseObject mediaInfo)
 {
     if (PlaybackStopped != null)
     {
         PlaybackStopped.Invoke(this, new PlaybackStoppedEventArgs
         {
             MediaInfo = mediaInfo
         });
     }
 }
Esempio n. 8
0
File: Device.cs Progetto: Cyrre/Emby
 private void OnPlaybackProgress(uBaseObject mediaInfo)
 {
     if (PlaybackProgress != null)
     {
         PlaybackProgress.Invoke(this, new PlaybackProgressEventArgs
         {
             MediaInfo = mediaInfo
         });
     }
 }
Esempio n. 9
0
File: Device.cs Progetto: Cyrre/Emby
 private void OnPlaybackStart(uBaseObject mediaInfo)
 {
     if (PlaybackStart != null)
     {
         PlaybackStart.Invoke(this, new PlaybackStartEventArgs
         {
             MediaInfo = mediaInfo
         });
     }
 }
Esempio n. 10
0
File: Device.cs Progetto: Cyrre/Emby
        private void UpdateMediaInfo(uBaseObject mediaInfo, TRANSPORTSTATE state)
        {
            TransportState = state;

            var previousMediaInfo = CurrentMediaInfo;
            CurrentMediaInfo = mediaInfo;

            if (previousMediaInfo == null && mediaInfo != null)
            {
                if (state != TRANSPORTSTATE.STOPPED)
                {
                    OnPlaybackStart(mediaInfo);
                }
            }
            else if (mediaInfo != null && previousMediaInfo != null && !mediaInfo.Equals(previousMediaInfo))
            {
                OnMediaChanged(previousMediaInfo, mediaInfo);
            }
            else if (mediaInfo == null && previousMediaInfo != null)
            {
                OnPlaybackStop(previousMediaInfo);
            }
            else if (mediaInfo != null && mediaInfo.Equals(previousMediaInfo))
            {
                OnPlaybackProgress(mediaInfo);
            }
        }
Esempio n. 11
0
File: Device.cs Progetto: Cyrre/Emby
 private void OnMediaChanged(uBaseObject old, uBaseObject newMedia)
 {
     if (MediaChanged != null)
     {
         MediaChanged.Invoke(this, new MediaChangedEventArgs
         {
             OldMediaInfo = old,
             NewMediaInfo = newMedia
         });
     }
 }
Esempio n. 12
0
        private PlaybackStartInfo GetProgressInfo(uBaseObject mediaInfo)
        {
            var info = StreamParams.ParseFromUrl(mediaInfo.Url, _libraryManager);

            return(GetProgressInfo(mediaInfo, info));
        }