Skip to content
This repository was archived by the owner on Nov 3, 2022. It is now read-only.
This repository was archived by the owner on Nov 3, 2022. It is now read-only.

Memory heap issues when stopping media player #85

@Ruud-cb

Description

@Ruud-cb

C#

//Starting:

    StorageFile file = await LocalStorage.GetMediaStorageFile(item);
    if (file != null)
    {
        VlcMediaPlayer.MediaSource = VLC.MediaSource.CreateFromUri(file.Path);
        VlcMediaPlayer.Visibility = Visibility.Visible;
    }
//Stopping:
                if (VlcMediaPlayer != null && VlcMediaPlayer.MediaPlayer != null && VlcMediaPlayer.MediaSource != null && VlcMediaPlayer.MediaPlayer.canPause())
                {
                    VlcMediaPlayer.Pause();
                    VlcMediaPlayer.Stop();
                }
                VlcMediaPlayer.Source = null;
                VlcMediaPlayer.MediaSource = null;

XAML:

<vlc:MediaElement x:Name="VlcMediaPlayer"  Grid.Row="1" Grid.Column="1" AreTransportControlsEnabled="True" AutoPlay="True" Visibility="Collapsed" />

It crashes on Stop(), if I don't call that, then it crashes on VlcMediaPlayer.MediaSource = null;. If I don't call that either, it crashes on the next time I try to set the MediaSource when starting.

The exception:

Unhandled exception at 0x774CF94D (ntdll.dll) in MyApp.exe: 0xC0000374: A heap has been corrupted (parameters: 0x7750B960).

I understand that something occurs when the media player is still playing and I try to stop it or remove the source, but what is the correct way to recycle the source?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions