Commit 05924bb7 authored by Martin Finkel's avatar Martin Finkel

repro

parent 5cf4821f
......@@ -551,10 +551,19 @@ namespace LibVLCSharp.Shared
_displayProgress = displayProgress ?? throw new ArgumentNullException(nameof(displayProgress));
_updateProgress = updateProgress ?? throw new ArgumentNullException(nameof(updateProgress));
//_dialogCbs = new DialogCallbacks((data, title, text) =>
//{
// _error?.Invoke(title, text);
//}, Login, Question, DisplayProgress, Cancel, UpdateProgress);
_dialogCbs = new DialogCallbacks(Error, Login, Question, DisplayProgress, Cancel, UpdateProgress);
// dialogCbsPtr = Marshal.AllocHGlobal(MarshalUtils.SizeOf(_dialogCbs));
// Marshal.StructureToPtr(_dialogCbs, dialogCbsPtr, true);
Native.LibVLCDialogSetCallbacks(NativeReference, _dialogCbs, IntPtr.Zero);
}
//IntPtr dialogCbsPtr;
/// <summary>
/// Unset dialog callbacks if previously set
/// </summary>
......@@ -585,8 +594,8 @@ namespace LibVLCSharp.Shared
static UpdateProgress? _updateProgress;
static readonly Dictionary<IntPtr, CancellationTokenSource> _cts = new Dictionary<IntPtr, CancellationTokenSource>();
[MonoPInvokeCallback(typeof(DisplayErrorCallback))]
static void Error(IntPtr data, string title, string text)
//[MonoPInvokeCallback(typeof(DisplayErrorCallback))]
/*static*/ void Error(IntPtr data, string title, string text)
{
_error?.Invoke(title, text);
}
......
......@@ -5,9 +5,13 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LibVLCSharp.WPF.Sample"
mc:Ignorable="d"
xmlns:uc="clr-namespace:LibVLCSharp.WPF;assembly=LibVLCSharp.WPF"
Title="LibVLCSharp.WPF.Sample" Height="450" Width="800">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Content="Example 1" Width="100" Height="50" Margin="15" x:Name="Example1Btn" />
<Button Content="Example 2" Width="100" Height="50" Margin="15" x:Name="Example2Btn" />
</StackPanel>
</Window>
\ No newline at end of file
<Grid>
<uc:VideoView x:Name="VideoView" Panel.ZIndex="1">
<StackPanel Orientation="Horizontal" x:Name="test">
<Button Content="PLAY" Height="25" Width="50" VerticalAlignment="Bottom" HorizontalAlignment="Left" Click="ButtonBase_OnClick" />
</StackPanel>
</uc:VideoView>
</Grid>
</Window>
using System.Windows;
using System.Threading.Tasks;
using System.Windows;
using LibVLCSharp.Shared;
namespace LibVLCSharp.WPF.Sample
{
public partial class MainWindow : Window
{
private LibVLC _libVLC;
private MediaPlayer _mediaPlayer;
public MainWindow()
{
InitializeComponent();
Example1Btn.Click += Example1Btn_Click;
Example2Btn.Click += Example2Btn_Click;
}
void Example1Btn_Click(object sender, RoutedEventArgs e)
{
var window = new Example1();
window.Show();
_libVLC = new LibVLC();
_libVLC.SetDialogHandlers((title, text) => Task.CompletedTask,
(dialog, title, text, username, store, token) => Task.CompletedTask,
(dialog, title, text, type, cancelText, actionText, secondActionText, token) => Task.CompletedTask,
(dialog, title, text, indeterminate, position, cancelText, token) => Task.CompletedTask,
(dialog, position, text) => Task.CompletedTask);
_mediaPlayer = new MediaPlayer(_libVLC);
VideoView.MediaPlayer = _mediaPlayer;
}
void Example2Btn_Click(object sender, RoutedEventArgs e)
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
var window = new Example2();
window.Show();
_mediaPlayer.Play(new Media(_libVLC,
"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/NOTEXISTINGURL.mp4", FromType.FromLocation));
}
}
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment