【问题标题】:VLC vlcControl disconnected stateVLC vlcControl 断开状态
【发布时间】:2019-01-30 13:11:58
【问题描述】:

我在我的 C# 应用程序中使用 vlcControl 流式传输 rtsp。我通过这段代码运行控件:

Private Sub MyControl_Load(sender As Object, e As EventArgs) Handles Me.Load
    VlcControl1.Video.AspectRatio = "5:4"
    Dim options = New String() {"--zoom=.75"}
    Dim urlString = $"rtsp://{CurrentOfflineSetting.camuserName}:{CurrentOfflineSetting.camPassword}@{CurrentOfflineSetting.CameraIP}:{CurrentOfflineSetting.CameraPort}/cam/realmonitor?channel=1&subtype=1&unicast=true&proto=Onvif"
    Dim url = New Uri(urlString)
    VlcControl1.Play(url, options)
End Sub

播放效果很好。如果出现错误,我会像这样重新连接来处理它:

Private Sub VlcControl1_EncounteredError(sender As Object, e As VlcMediaPlayerEncounteredErrorEventArgs) Handles VlcControl1.EncounteredError
    Dim options = New String() {"--zoom=.75"}
    Dim urlString = $"rtsp://{CurrentOfflineSetting.camuserName}:{CurrentOfflineSetting.camPassword}@{CurrentOfflineSetting.CameraIP}:{CurrentOfflineSetting.CameraPort}/cam/realmonitor?channel=1&subtype=1&unicast=true&proto=Onvif"
    Dim url = New Uri(urlString)
    VlcControl1.Play(url, options)
End Sub

我的问题是;如果与相机的连接断开或中断怎么办?我如何知道它是否已断开连接并且不再流式传输?有时流会停止(看起来像暂停)。一旦发生这种情况,我可以重新连接,但问题是,我不知道流媒体是否停止,因为它不会引发任何错误,只是停止。需要你的帮助。谢谢。

【问题讨论】:

    标签: c# libvlc


    【解决方案1】:

    我不知道您使用的是什么包装器,但就像EncounteredError 事件一样,您也应该有一个Stopped 事件。

    【讨论】:

      猜你喜欢
      • 2021-09-22
      • 2015-09-18
      • 2017-07-14
      • 2013-09-01
      • 2019-02-06
      • 1970-01-01
      • 2012-01-28
      • 2019-04-23
      • 2019-07-07
      相关资源
      最近更新 更多