mirror of
https://github.com/ZuneDev/ZuneShell.dll.git
synced 2026-07-27 13:11:51 -07:00
PlayerInteropAudioService position reporting
This commit is contained in:
@@ -18,6 +18,7 @@ namespace Microsoft.Zune.Playback
|
||||
private readonly IModifiableFolder _tempFolder;
|
||||
private PlaybackItem m_currentSource;
|
||||
private int _playbackId = 0;
|
||||
private TimeSpan _position;
|
||||
|
||||
public PlayerInteropAudioService(IModifiableFolder tempFolder) : this()
|
||||
{
|
||||
@@ -36,6 +37,8 @@ namespace Microsoft.Zune.Playback
|
||||
private PlayerInteropAudioService()
|
||||
{
|
||||
_playbackWrapper.Initialize();
|
||||
|
||||
_playbackWrapper.TransportPositionChanged += PlaybackWrapper_TransportPositionChanged;
|
||||
}
|
||||
|
||||
public static PlayerInteropAudioService Instance => new();
|
||||
@@ -52,7 +55,15 @@ namespace Microsoft.Zune.Playback
|
||||
}
|
||||
}
|
||||
|
||||
public TimeSpan Position => new(_playbackWrapper.Position);
|
||||
public TimeSpan Position
|
||||
{
|
||||
get => _position;
|
||||
set
|
||||
{
|
||||
_position = value;
|
||||
PositionChanged?.Invoke(this, value);
|
||||
}
|
||||
}
|
||||
|
||||
public PlaybackState PlaybackState => _playbackWrapper.TransportState switch
|
||||
{
|
||||
@@ -188,6 +199,11 @@ namespace Microsoft.Zune.Playback
|
||||
public string Uri { get; }
|
||||
public int Id { get; }
|
||||
}
|
||||
|
||||
private void PlaybackWrapper_TransportPositionChanged(object sender, EventArgs e)
|
||||
{
|
||||
Position = new(_playbackWrapper.Position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user