none
[UWP]UWP c# Set minimum allowed bitrate RRS feed

  • Question

  • 0
    <button aria-label="down vote" aria-pressed="false" class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer" data-selected-classes="fc-theme-primary" style="box-sizing:inherit;font:inherit;padding:0px;border-width:initial;border-style:none;border-color:initial;border-radius:3px;background-image:none;background-background-size:initial;background-repeat:initial;background-attachment:initial;background-origin:initial;background-clip:initial;outline:none;box-shadow:none;margin:2px;" title="This question does not show any research effort; it is unclear or not useful"><svg aria-hidden="true" class="svg-icon m0 iconArrowDownLg" height="36" viewBox="0 0 36 36" width="36"><path d="M2 10h32L18 26z"></path></svg></button><button aria-label="favorite" aria-pressed="false" class="js-favorite-btn s-btn s-btn__unset c-pointer py8" data-selected-classes="fc-yellow-600" style="box-sizing:inherit;font:inherit;padding:0px;border-width:initial;border-style:none;border-color:initial;border-radius:3px;background-image:none;background-background-size:initial;background-repeat:initial;background-attachment:initial;background-origin:initial;background-clip:initial;outline:none;box-shadow:none;" title="Click to mark as favorite question (click again to undo)"><svg aria-hidden="true" class="svg-icon iconStar" height="18" viewBox="0 0 18 18" width="18"><path d="M9 12.65l-5.29 3.63 1.82-6.15L.44 6.22l6.42-.17L9 0l2.14 6.05 6.42.17-5.1 3.9 1.83 6.16z"></path></svg>
    </button>

    I have a c# uwp app playing video content. I want to set the minimum bitrate to 0.3Mbps as when dropping below it enters audio only mode. Code below but when i restrict the network the bitrate drops to 0.1Mbps. how do i restrict the media player choosing the lowest available bitrate?

    AdaptiveMediaSourceCreationResult result = await AdaptiveMediaSource.CreateFromUriAsync(pathUri);
                        var mediaSource = MediaSource.CreateFromAdaptiveMediaSource(result.MediaSource);
                        result.MediaSource.DesiredMinBitrate = 300;
                        var mediaPlaybackItem = new MediaPlaybackItem(mediaSource);
                        result.MediaSource.PlaybackBitrateChanged += BitrateChange;
                        Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
                        this.media.SetMediaPlayer(this.mediaPlayer);
                        this.mediaPlayer.PlaybackSession.BufferingStarted += media_StateChanged_BufferingStarted;
                        this.mediaPlayer.PlaybackSession.BufferingEnded += media_StateChanged_BufferingEnded;
                        this.mediaPlayer.PlaybackSession.PlaybackStateChanged += media_StateChanged;
                        this.mediaPlayer.MediaFailed += MediaPlayer_MediaFailed;
                        this.ConvivaOb.SetPlayerProxy(this.mediaPlayer);
                        this.mediaPlayer.Source = mediaPlaybackItem;
                        mediaPlaybackItem.TimedMetadataTracksChanged += RegisterMetadataHandlerForID3Cues;
                        this.mediaPlayer.Play();


    Thursday, January 17, 2019 1:53 PM

All replies

  • Hi,

    Well, it seems not to be a good practice. As far as I know, in UWP apps, there is not build-in APIs that could implement real time monitoring. Even it is possible to get that it will definitely cost a lot of network resources. So it's not good to monitor the Network bitrate.

    My suggestion is that you could create a timer and set a time limitation. When the time is running out but the audio is still not ready. Then try to use a lower bitrate.

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, January 18, 2019 7:25 AM
    Moderator