Skip to content

Xamarin.Forms MediaPlayerElement casting button doesn't show

Summary

I installed LibVLCSharp, it is amazing lib, but I have issue when the video player work, the Cast button doesn't appear since I set the IsCastButtonVisible property to True. Everything is work well except the Cast button I read the previous issue ticket: #235 (closed) It didn't help me help me because I installed last version.

Here is my xaml code:

    <shared:MediaPlayerElement 
        x:Name="contentVideo" 
        HorizontalOptions="FillAndExpand" 
        VerticalOptions="FillAndExpand"
         >
        <shared:MediaPlayerElement.PlaybackControls>
            <shared:PlaybackControls
                IsAspectRatioButtonVisible="True"
                IsCastButtonVisible="True"
                IsLockButtonVisible="False" />
        </shared:MediaPlayerElement.PlaybackControls>
    </shared:MediaPlayerElement>

And in the code:

        LibVLC _libVlc;
        public ContentPlayerPage(ContentCurriculumModel contentCurriculumModel)
        {
            InitializeComponent();
            Core.Initialize();
            _libVlc = new LibVLC();

           

            var media = new Media(_libVlc, contentCurriculumModel.ContentURL, // url of video 
                FromType.FromLocation);
            
            contentVideo.MediaPlayer = new MediaPlayer(media) { EnableHardwareDecoding = true };
            contentVideo.MediaPlayer.Play();
        }

Environment

LibVLCSharp.Forms version: 3.6.5 Xamarin.Forms version: 5.0.0.2291

Edited by i-marasa
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information