MediaSourceAudioInputNode.Position property doesn't work properly

vansa 41 Reputation points
2022-03-17T13:38:19.717+00:00

I'm using MediaSourceAudioInputNode.Position for Audio Graph to get the position of the playback. It always gives 0 value.

For comparison, using Media Playback class such as MediaPlaybackSession.Position Property works fine. It gives me the position of the playback.

Universal Windows Platform (UWP)
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,654 questions
{count} votes

Accepted answer
  1. Roy Li - MSFT 33,446 Reputation points Microsoft Vendor
    2022-04-05T04:25:04.44+00:00

    Hello,

    Welcome to Microsoft Q&A!

    It always gives 0 value. Is there a way to get the position/time of the playback for live content?

    @vansa I've gotten the response from the team and we could confirm this behavior is by design. Live streams don't have an end, so its file duration is set to -1. This value is generally used to calculate the current position in conjunction with a calculation based on the sampling rate of the audio format. The result of this calculation is always going to be 0 because of the duration value.

    Currently, there is no workaround when the live stream doesn't have a specified end time or duration.

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.