-
在C#中,利用Libvlc库可以实现录制/录像功能的源代码
资源介绍
///
/// 创建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;
}
}
- 上一篇: C# USB摄像头多开工具
- 下一篇: C#麦克风混音录制,保存MP3格式在本地