///
/// 创建VLC播放器
///
/// VLC 全局变量
/// VLC MediaPlayer需要绑定显示的窗体句柄
///
public static libvlc_media_player_t Create_MediaPlayer(libvlc_instance_t libvlc_instance, IntPtr handle)
{
libvlc_media_player_t libvlc_media_player = IntPtr.Zero;
try
{
if (libvlc_instance == IntPtr.Zero ||
libvlc_instance == null ||
handle == IntPtr.Zero ||
handle == null)
{
return IntPtr.Zero;
}
//创建播放器
libvlc_media_player = SafeNativeMethods.libvlc_media_player_new(libvlc_instance);
if (libvlc_media_player == null || libvlc_media_player == IntPtr.Zero)
{
return IntPtr.Zero;
}
//设置播放窗口
SafeNativeMethods.libvlc_media_player_set_hwnd(libvlc_media_player, (int)handle);
return libvlc_media_player;
}
catch
{
SafeNativeMethods.libvlc_media_player_release(libvlc_media_player);
return IntPtr.Zero;
}
}
2021-11-02 15:37:25
43.51MB
Libvlc
1