bug in MediaSource.OpenAsync() (Windows.Media.Core.dll)

Elton Lame 1 Reputation point
2020-08-10T15:54:45.477+00:00

Hello,
i'm developing an app in uwp and i have problem with this code:

private async Task<bool> CheckLink(string url)
{
    using (MediaSource ms = MediaSource.CreateFromUri(new Uri(url)))
    {
        try
        {
            await ms.OpenAsync();
            return true;
        }
        catch (Exception)
        {
            return false;
        }
    }
}

private async void Button_Click(object sender, RoutedEventArgs e)
{
    bool result = await CheckLink("https://tv.oranews.tv/live/oranews/index.m3u8")
    //...
}

This code crashes only with this particular url. With other url is ok. I tried to debug but the crash happens in native library Windows.Media.dll.
I hope this is the correct form to report this.

Developer technologies | Universal Windows Platform (UWP)
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2020-08-11T03:00:02.587+00:00

    Hello,

    Welcome to Microsoft Q&A!

    I made a test with the m3u8 uri you post and also these two files you shared. I get a very interesting result. The uri in your original post works correctly on my side. But I will get exceptions when directly create MediaSource objects using the local m3u8. Maybe it should work when using uri.

    Anyway, in my testing, the uir 'https://tv.oranews.tv/live/oranews/index.m3u8' works correctly. It is different result with yours.

    This is the code I'm using:

                 MediaSource ms1 = MediaSource.CreateFromUri(new Uri("https://tv.oranews.tv/live/oranews/index.m3u8"));
    
                await ms1.OpenAsync();
    

    It would be better if you could share me the OS version of your device and target version of your app.

    Thank you.


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.