本文介绍了当我在VB.Net上暂停流视频VLC组件时。几分钟后回来。再次单击“播放”,从开始或停止重新开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 当我在VB.Net上暂停流视频VLC组件时。几分钟后回来。再次单击播放,从头开始重新启动。然后我必须点击滑块上的最后一个点,所以要恢复 有时这甚至会在没有播放流视频时发生暂停,突然间会从一开始就停止或重新启动。然后我必须手动点击滑块上的位置并等待再次缓冲 有谁知道修复此问题? 以下代码: Imports System.Text.RegularExpressions Public 类 Form1 Dim 暂停作为 Boolean = False Dim 已开始 As Boolean = False Dim PlayedSecond As Boolean = 真 私人 Sub Button1_Click(发件人作为 对象,e As EventArgs)句柄 Button1.Click PlayedSecond = False AxVLCPlugin21.playlist.items.clear() AxVLCPlugin21.playlist.add( http://binder-science.wikispaces.com/file/view/The+Characteristics+of+Living+Things.flv) AxVLCPlugin21.playlist .play() Started = True 结束 Sub Sub playsecond() AxVLCPlugin21.playlist.items.clear() AxVLCPlugin21.playlist.add( http://postfcs.wikispaces.com/file/view/Nature+by+Numbers+%5Bwww.keepvid.com%5D.flv) AxVLCPlugin21.playlist .play() PlayedSecond = True Started = False 结束 Sub 私有 Sub AxVLCPlugin21_pause(发件人作为 对象,e As EventArgs)句柄 AxVLCPlugin21.pause Paused = True 结束 Sub 私有 Sub IsFinished_Tick(发件人作为 对象,e As EventArgs)句柄 IsFinished.Tick 如果 不 AxVLCPlugin21。 playlist.isPlaying 和已暂停= 错误 和已开始= True PlayedSecond = False 然后 playsecond()开始= 真 结束 如果 结束 Sub 私有 Sub AxVLC Plugin21_play(发件人作为 对象,e 作为 EventArgs)句柄 AxVLCPlugin21.play 暂停= 错误 结束 Sub 私人 枚举 InputState IDLE = 0 OPENING = 1 BUFFERING = 2 PLAYING = 3 PAUSED = 4 STOPPING = 5 ENDED = 6 ERRORSTATE = 7 结束 枚举 私有 Sub InfoTimer_Tick(发件人作为 对象,e As EventArgs)句柄 InfoTimer.Tick Dim state As InputState = DirectCast (AxVLCPlugin21.input.state,InputState) 选择 案例州 案例 InputState.IDLE,InputState.OPENING,InputState.BUFFERING Status.Text = state.ToString() 退出 选择 案例 InputState.PLAYING Dim title As 字符串 = System.IO.Path.GetFileName(AxVLCPlugin21.mediaDescription.title) Dim 当前 As TimeSpan = TimeSpan.FromMilliseconds(AxVLCPlugin21.input.Time) Dim total As TimeSpan = TimeSpan.FromMilliseconds(AxVLCPlugin21.input.Length) Dim pos 正如 Double = AxVLCPlugin21.input.Position Status.Text = String 。格式( {0} {1} {2}:{3:D2} / {4}:{5: D2} {6:P},state,title,current.Minutes,current.S econds,total.Minutes,total.Seconds,pos) 退出 选择 案例 InputState.PAUSED Status.Text = 字符串 .Format( {0} {1},state,System.IO.Path.GetFileName(AxVLCPlugin21.mediaDescription.title)) 退出 选择 案例 InputState.STOPPING,InputState.ENDED playsecond() 退出 选择 案例 InputState.ERRORSTATE Status.Text = 字符串 .Format( {0} {1},state,AxVLCPlugin21.mediaDescription.title) 退出 选择 案例 Else Status.Text = state.ToString() 退出 选择 结束 选择 结束 Sub 结束 类 解决方案 这是您正在使用的VLC组件的内部问题,而不是您的VB.NET代码。 联系您正在使用的组件的制造商以获得支持此 When I pause streaming video VLC component on VB.Net. Come back few minutes later. Click play again it restarts from beginning. Then I have to click point on slider where was last at, so to resumeSometimes this will even occur when playing streamed video without being paused, all of a sudden will stop or restart from beginning. And I will have to then click position on slider manually and wait to buffer againDoes anyone know of a fix for this?Code below:Imports System.Text.RegularExpressions Public Class Form1 Dim Paused As Boolean = False Dim Started As Boolean = False Dim PlayedSecond As Boolean = True Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click PlayedSecond = False AxVLCPlugin21.playlist.items.clear() AxVLCPlugin21.playlist.add("http://binder-science.wikispaces.com/file/view/The+Characteristics+of+Living+Things.flv") AxVLCPlugin21.playlist.play() Started = True End Sub Sub playsecond() AxVLCPlugin21.playlist.items.clear() AxVLCPlugin21.playlist.add("http://postfcs.wikispaces.com/file/view/Nature+by+Numbers+%5Bwww.keepvid.com%5D.flv") AxVLCPlugin21.playlist.play() PlayedSecond = True Started = False End Sub Private Sub AxVLCPlugin21_pause(sender As Object, e As EventArgs) Handles AxVLCPlugin21.pause Paused = True End Sub Private Sub IsFinished_Tick(sender As Object, e As EventArgs) Handles IsFinished.Tick If Not AxVLCPlugin21.playlist.isPlaying And Paused = False And Started = True And PlayedSecond = False Then playsecond() Started = True End If End Sub Private Sub AxVLCPlugin21_play(sender As Object, e As EventArgs) Handles AxVLCPlugin21.play Paused = False End Sub Private Enum InputState IDLE = 0 OPENING = 1 BUFFERING = 2 PLAYING = 3 PAUSED = 4 STOPPING = 5 ENDED = 6 ERRORSTATE = 7 End Enum Private Sub InfoTimer_Tick(sender As Object, e As EventArgs) Handles InfoTimer.Tick Dim state As InputState = DirectCast(AxVLCPlugin21.input.state, InputState) Select Case state Case InputState.IDLE, InputState.OPENING, InputState.BUFFERING Status.Text = state.ToString() Exit Select Case InputState.PLAYING Dim title As String = System.IO.Path.GetFileName(AxVLCPlugin21.mediaDescription.title) Dim current As TimeSpan = TimeSpan.FromMilliseconds(AxVLCPlugin21.input.Time) Dim total As TimeSpan = TimeSpan.FromMilliseconds(AxVLCPlugin21.input.Length) Dim pos As Double = AxVLCPlugin21.input.Position Status.Text = String.Format("{0} {1} {2}:{3:D2}/{4}:{5:D2} {6:P}", state, title, current.Minutes, current.Seconds, total.Minutes, total.Seconds, pos) Exit Select Case InputState.PAUSED Status.Text = String.Format("{0} {1}", state, System.IO.Path.GetFileName(AxVLCPlugin21.mediaDescription.title)) Exit Select Case InputState.STOPPING, InputState.ENDED playsecond() Exit Select Case InputState.ERRORSTATE Status.Text = String.Format("{0} {1}", state, AxVLCPlugin21.mediaDescription.title) Exit Select Case Else Status.Text = state.ToString() Exit Select End Select End Sub End Class 解决方案 That is an internal problem with the VLC component you''re using, not with your VB.NET code.Contact the manufacturer of the component you''re using for support on this. 这篇关于当我在VB.Net上暂停流视频VLC组件时。几分钟后回来。再次单击“播放”,从开始或停止重新开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 11-02 23:02