Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.

[Bug] MediaElement crashes with NullReferenceException from certain https locations and not others #579

Open
@ashlar64

Description

@ashlar64

Description

MediaElement crashes with certain videos from the internet.

Steps to Reproduce

I attached some xaml code that shows the MediaElement working in one scenario and failing in two others. You need to uncomment the MediaElement control for each scenario to see it.

``

<ContentPage.Content>
    <ContentView>
        <Grid  BackgroundColor="Transparent">
                <Grid.RowDefinitions>
                    <RowDefinition Height="40" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="20" />
                </Grid.RowDefinitions>


            <Button Text="Test" Command="{Binding TestCommand}" />

            <!-- This one works fine -->
            <!--<MediaElement Grid.Row="1" Source="https://sec.ch9.ms/ch9/5d93/a1eab4bf-3288-4faf-81c4-294402a85d93/XamarinShow_mid.mp4"
          ShowsPlaybackControls="True" />-->

            <!-- Causes a System.NullReferenceException: 'Object reference not set to an instance of an object.' -->
            <!-- when viewed with a browser it will attempt to download.  The content-type is 	application/octet-stream  -->
            <MediaElement Grid.Row="1" Source="https://growjoey2020.blob.core.windows.net/media/2020/7/10/637299956869735561_637299956840476600.mp4"
          ShowsPlaybackControls="True" />

            <!-- Get a popup saying 'Can't play this video' and then it crashes with System.NullReferenceException: 'Object reference not set to an instance of an object.' -->
            <!-- this was saved on Azure with the content type is   video/mp4    and works fine if viewed from a browser-->   
            <!--<MediaElement Grid.Row="1" Source="https://growjoey2020.blob.core.windows.net/media/hempliance-b2c.mp4"
          ShowsPlaybackControls="True"  />-->


        </Grid>  
    </ContentView>
</ContentPage.Content>

Expected Behavior

To display the video crorrectly

Actual Behavior

Crashes with this exception:
System.NullReferenceException
Message=Object reference not set to an instance of an object.

Basic Information

  • Version with issue: Xamarin.Forms 4.8.0.1451 (and earlier)
  • Last known good version: none
  • IDE: Visual Studio 2019
  • Platform Target Frameworks:
    • iOS: I am unable to test it on ios at this time
    • Android: Target version is Android 9.0 but it did not work on previous versions either
    • UWP: I have done no tests with UWP
  • Android Support Library Version:
  • Nuget Packages: Xamarin.Forms 4.8.0.1451 (and earlier)
  • Affected Devices: Android devices, not able to compile ios devices at this time

I had similar issues when using the Octane video library on Android. But on ios with the Octane library it was working fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a/MediaElementbugSomething isn't working. Breaky break.s/unverifiedThis issue needs verification/reproduction by a team member. PRs cannot be accepted/merged.up-for-grabsImplementation from community can be started.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions