diff --git a/src/widgets/emby/component.jsx b/src/widgets/emby/component.jsx index a78ad51f2..479441db9 100644 --- a/src/widgets/emby/component.jsx +++ b/src/widgets/emby/component.jsx @@ -29,17 +29,19 @@ function ticksToString(ticks) { function SingleSessionEntry({ playCommand, session }) { const { - NowPlayingItem: { Name, SeriesName, RunTimeTicks }, + NowPlayingItem: { Name, SeriesName }, PlayState: { PositionTicks, IsPaused, IsMuted }, } = session; + const RunTimeTicks = session.NowPlayingItem?.RunTimeTicks ?? session.NowPlayingItem?.CurrentProgram?.RunTimeTicks ?? 0; + const { IsVideoDirect, VideoDecoderIsHardware, VideoEncoderIsHardware } = session?.TranscodingInfo || { IsVideoDirect: true, VideoDecoderIsHardware: true, VideoEncoderIsHardware: true, }; - const percent = (PositionTicks / RunTimeTicks) * 100; + const percent = Math.min(1, PositionTicks / RunTimeTicks) * 100; return ( <> @@ -98,13 +100,15 @@ function SingleSessionEntry({ playCommand, session }) { function SessionEntry({ playCommand, session }) { const { - NowPlayingItem: { Name, SeriesName, RunTimeTicks }, + NowPlayingItem: { Name, SeriesName }, PlayState: { PositionTicks, IsPaused, IsMuted }, } = session; + const RunTimeTicks = session.NowPlayingItem?.RunTimeTicks ?? session.NowPlayingItem?.CurrentProgram?.RunTimeTicks ?? 0; + const { IsVideoDirect, VideoDecoderIsHardware, VideoEncoderIsHardware } = session?.TranscodingInfo || {}; - const percent = (PositionTicks / RunTimeTicks) * 100; + const percent = Math.min(1, PositionTicks / RunTimeTicks) * 100; return (