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

repro

parent 5cf4821f
...@@ -551,10 +551,19 @@ namespace LibVLCSharp.Shared ...@@ -551,10 +551,19 @@ namespace LibVLCSharp.Shared
_displayProgress = displayProgress ?? throw new ArgumentNullException(nameof(displayProgress)); _displayProgress = displayProgress ?? throw new ArgumentNullException(nameof(displayProgress));
_updateProgress = updateProgress ?? throw new ArgumentNullException(nameof(updateProgress)); _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); _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); Native.LibVLCDialogSetCallbacks(NativeReference, _dialogCbs, IntPtr.Zero);
} }
//IntPtr dialogCbsPtr;
/// <summary> /// <summary>
/// Unset dialog callbacks if previously set /// Unset dialog callbacks if previously set
/// </summary> /// </summary>
...@@ -585,8 +594,8 @@ namespace LibVLCSharp.Shared ...@@ -585,8 +594,8 @@ namespace LibVLCSharp.Shared
static UpdateProgress? _updateProgress; static UpdateProgress? _updateProgress;
static readonly Dictionary<IntPtr, CancellationTokenSource> _cts = new Dictionary<IntPtr, CancellationTokenSource>(); static readonly Dictionary<IntPtr, CancellationTokenSource> _cts = new Dictionary<IntPtr, CancellationTokenSource>();
[MonoPInvokeCallback(typeof(DisplayErrorCallback))] //[MonoPInvokeCallback(typeof(DisplayErrorCallback))]
static void Error(IntPtr data, string title, string text) /*static*/ void Error(IntPtr data, string title, string text)
{ {
_error?.Invoke(title, text); _error?.Invoke(title, text);
} }
......
...@@ -5,9 +5,13 @@ ...@@ -5,9 +5,13 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LibVLCSharp.WPF.Sample" xmlns:local="clr-namespace:LibVLCSharp.WPF.Sample"
mc:Ignorable="d" mc:Ignorable="d"
xmlns:uc="clr-namespace:LibVLCSharp.WPF;assembly=LibVLCSharp.WPF"
Title="LibVLCSharp.WPF.Sample" Height="450" Width="800"> Title="LibVLCSharp.WPF.Sample" Height="450" Width="800">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"> <Grid>
<Button Content="Example 1" Width="100" Height="50" Margin="15" x:Name="Example1Btn" /> <uc:VideoView x:Name="VideoView" Panel.ZIndex="1">
<Button Content="Example 2" Width="100" Height="50" Margin="15" x:Name="Example2Btn" /> <StackPanel Orientation="Horizontal" x:Name="test">
</StackPanel> <Button Content="PLAY" Height="25" Width="50" VerticalAlignment="Bottom" HorizontalAlignment="Left" Click="ButtonBase_OnClick" />
</Window> </StackPanel>
\ No newline at end of file </uc:VideoView>
</Grid>
</Window>
using System.Windows; using System.Threading.Tasks;
using System.Windows;
using LibVLCSharp.Shared;
namespace LibVLCSharp.WPF.Sample namespace LibVLCSharp.WPF.Sample
{ {
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
private LibVLC _libVLC;
private MediaPlayer _mediaPlayer;
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
Example1Btn.Click += Example1Btn_Click;
Example2Btn.Click += Example2Btn_Click;
}
void Example1Btn_Click(object sender, RoutedEventArgs e) _libVLC = new LibVLC();
{ _libVLC.SetDialogHandlers((title, text) => Task.CompletedTask,
var window = new Example1(); (dialog, title, text, username, store, token) => Task.CompletedTask,
window.Show(); (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(); _mediaPlayer.Play(new Media(_libVLC,
window.Show(); "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