try to add MAUI support
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
using Microsoft.Maui.Handlers;
|
||||
using static Microsoft.Maui.ApplicationModel.Permissions;
|
||||
|
||||
namespace TV_Player.MAUI
|
||||
{
|
||||
//public partial class MediaViewerHandler : ViewHandler<MediaViewer, VideoView>
|
||||
//{
|
||||
// VideoView _videoView;
|
||||
// LibVLC _libVLC;
|
||||
// LibVLCSharp.Shared.MediaPlayer _mediaPlayer;
|
||||
|
||||
// protected override VideoView CreatePlatformView() => new VideoView(Context);
|
||||
|
||||
// protected override void ConnectHandler(VideoView nativeView)
|
||||
// {
|
||||
// base.ConnectHandler(nativeView);
|
||||
|
||||
// _libVLC = new LibVLC(enableDebugLogs: true);
|
||||
// _mediaPlayer = new LibVLCSharp.Shared.MediaPlayer(_libVLC)
|
||||
// {
|
||||
// EnableHardwareDecoding = true
|
||||
// };
|
||||
|
||||
// _videoView = nativeView ?? new VideoView(Context);
|
||||
// _videoView.MediaPlayer = _mediaPlayer;
|
||||
|
||||
// HandleUrl(VirtualView.StreamUrl);
|
||||
|
||||
// base.ConnectHandler(nativeView);
|
||||
// }
|
||||
|
||||
// protected override void DisconnectHandler(VideoView nativeView)
|
||||
// {
|
||||
// nativeView.Dispose();
|
||||
// base.DisconnectHandler(nativeView);
|
||||
// }
|
||||
|
||||
// private void HandleUrl(string url)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
|
||||
// if (url.EndsWith("/"))
|
||||
// {
|
||||
// url = url.TrimEnd('/');
|
||||
// }
|
||||
|
||||
// //url = "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4";
|
||||
|
||||
// if (!string.IsNullOrEmpty(url))
|
||||
// {
|
||||
// var media = new Media(_libVLC, url, FromType.FromLocation);
|
||||
|
||||
// _mediaPlayer.NetworkCaching = 1500;
|
||||
|
||||
// if (_mediaPlayer.Media != null)
|
||||
// {
|
||||
// _mediaPlayer.Stop();
|
||||
// _mediaPlayer.Media.Dispose();
|
||||
// }
|
||||
|
||||
// _mediaPlayer.Media = media;
|
||||
// _mediaPlayer.Mute = true;
|
||||
|
||||
// _videoView.MediaPlayer.Play();
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
|
||||
//}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
|
||||
namespace TV_Player.MAUI
|
||||
{
|
||||
|
||||
public class MediaViewer : ContentView
|
||||
{
|
||||
//private MediaPlayer _mediaPlayer;
|
||||
|
||||
public static BindableProperty StreamUrlProperty = BindableProperty.Create(nameof(StreamUrl)
|
||||
, typeof(string)
|
||||
, typeof(MediaViewer)
|
||||
, ""
|
||||
, defaultBindingMode: BindingMode.TwoWay);
|
||||
|
||||
public string StreamUrl
|
||||
{
|
||||
get => (string)GetValue(StreamUrlProperty);
|
||||
set
|
||||
{
|
||||
SetValue(StreamUrlProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
public MediaViewer()
|
||||
{
|
||||
InitializeMediaPlayer();
|
||||
}
|
||||
|
||||
private void InitializeMediaPlayer()
|
||||
{
|
||||
// var media = new Media(_libVLC, new Uri("http://ost.da-tv.vip/uPVtzdGJfdG9rZW5dIiwibCI6ImE3MWU3N2ZhIiwicCI6ImE3MWU3N2ZhODM1YjMyMTYiLCJjIjoiNDk3IiwidCI6ImUzNjAwZTEwZmFmMGVhYjhhYWY1YTU2YzRkN2VjZTE5IiwiZCI6IjIzMTQ2IiwiciI6IjIzMDM4IiwibSI6InR2IiwiZHQiOiIwIn0eyJ1IjoiaHR0cDovLzQ1LjkzLjQ2LjI3Ojg4ODcvODM2MS92aWRlby5tM3U4P3Rva2V/video.m3u8"));
|
||||
//_mediaPlayer.Play();
|
||||
}
|
||||
|
||||
public void Play()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TV_Player.MAUI
|
||||
{
|
||||
// public partial class MediaViewerHandler
|
||||
// {
|
||||
// public static IPropertyMapper<MediaViewer, MediaViewerHandler> PropertyMapper =
|
||||
// new PropertyMapper<MediaViewer, MediaViewerHandler>()
|
||||
// {
|
||||
// };
|
||||
|
||||
// public static CommandMapper<MediaViewer, MediaViewerHandler> CommandMapper = new(ViewCommandMapper)
|
||||
// {
|
||||
// };
|
||||
|
||||
// public MediaViewerHandler() : base(PropertyMapper, CommandMapper)
|
||||
// {
|
||||
// }
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user