MediaPlayer.Position Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the playback position within the media.
Note
MediaPlayer.Position may be altered or unavailable after Windows 10, version 1607. Instead, use the MediaPlayer.PlaybackSession property to get a MediaPlaybackSession object and then use the MediaPlaybackSession.Position property.
public:
property TimeSpan Position { TimeSpan get(); void set(TimeSpan value); };
TimeSpan Position();
void Position(TimeSpan value);
/// [get: Windows.Foundation.Metadata.Deprecated("Use PlaybackSession.Position instead of Position. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 196608, "Windows.Foundation.UniversalApiContract")]
/// [set: Windows.Foundation.Metadata.Deprecated("Use PlaybackSession.Position instead of Position. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 196608, "Windows.Foundation.UniversalApiContract")]
TimeSpan Position();
void Position(TimeSpan value);
public System.TimeSpan Position { get; set; }
public System.TimeSpan Position { [Windows.Foundation.Metadata.Deprecated("Use PlaybackSession.Position instead of Position. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 196608, "Windows.Foundation.UniversalApiContract")] get; [Windows.Foundation.Metadata.Deprecated("Use PlaybackSession.Position instead of Position. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 196608, "Windows.Foundation.UniversalApiContract")] set; }
var timeSpan = mediaPlayer.position;
mediaPlayer.position = timeSpan;
Public Property Position As TimeSpan
Property Value
The playback position within the media.
- Attributes
Remarks
The position can't be moved forward while a MediaPlaybackItem with CanSkip set to false is playing. Attempting to do so will cause an exception to be thrown.