When streaming start from current location
This commit is contained in:
parent
609a16f468
commit
1b7b836b3e
@ -172,8 +172,15 @@ public class LmsSessionController : ISessionController, IDisposable
|
||||
var itemId = _playlist[index];
|
||||
_playlistIndex = index;
|
||||
|
||||
var streamUrl = BuildStreamUrl(itemId);
|
||||
_logger.LogInformation("Playing item {Index}/{Total}: {Url}", index + 1, _playlist.Length, streamUrl);
|
||||
// Build stream URL with start position - LMS can't seek on HTTP streams,
|
||||
// so we need to use Jellyfin's startTimeTicks parameter for transcoding
|
||||
var streamUrl = BuildStreamUrlWithPosition(itemId, startPositionTicks);
|
||||
_logger.LogInformation(
|
||||
"Playing item {Index}/{Total} from position {Position}s: {Url}",
|
||||
index + 1,
|
||||
_playlist.Length,
|
||||
startPositionTicks / TimeSpan.TicksPerSecond,
|
||||
streamUrl);
|
||||
|
||||
await _lmsClient.PlayUrlAsync(_player.MacAddress, streamUrl).ConfigureAwait(false);
|
||||
|
||||
@ -181,18 +188,15 @@ public class LmsSessionController : ISessionController, IDisposable
|
||||
CurrentItemId = itemId;
|
||||
IsPlaying = true;
|
||||
IsPaused = false;
|
||||
_seekOffsetTicks = 0; // Reset seek offset when starting a new track
|
||||
|
||||
// Track the seek offset so we report the correct position
|
||||
// When starting from a position, the transcoded stream starts at 0,
|
||||
// but we need to report the actual track position
|
||||
_seekOffsetTicks = startPositionTicks;
|
||||
|
||||
// Look up the item for duration info
|
||||
_currentItem = _libraryManager.GetItemById(itemId);
|
||||
|
||||
// Seek to start position if specified
|
||||
if (startPositionTicks > 0)
|
||||
{
|
||||
var positionSeconds = startPositionTicks / TimeSpan.TicksPerSecond;
|
||||
await _lmsClient.SeekAsync(_player.MacAddress, positionSeconds).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
// Report playback start to Jellyfin
|
||||
await ReportPlaybackStartAsync(itemId, startPositionTicks).ConfigureAwait(false);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user