Public Sub Main()
Dim pl As MediaPipeline
Dim src, dcb, aa, con, snk As MediaControl
Dim asrc, abin, acon, ares, asnk As MediaControl
Dim filevideo As String
Dim tm As Date
filevideo = "/ruta/del/fichero/video"
pl = New MediaPipeline
' Parte vídeo:
src = New MediaControl(pl, "filesrc")
src["location"] = filevideo
dcb = New MediaControl(pl, "decodebin")
aa = New MediaControl(pl, "aatv")
con = New MediaControl(pl, "videoconvert")
snk = New MediaControl(pl, "autovideosink")
src.LinkTo(dcb)
dcb.LinkLaterTo(aa)
aa.LinkTo(con)
con.LinkTo(snk)
' Parte audio:
asrc = New MediaControl(pl, "filesrc")
asrc["location"] = filevideo
abin = New MediaControl(pl, "decodebin")
acon = New MediaControl(pl, "audioconvert")
ares = New MediaControl(pl, "audioresample")
asnk = New MediaControl(pl, "autoaudiosink")
asrc.LinkTo(abin)
abin.LinkLaterTo(acon)
acon.LinkTo(ares)
ares.LinkTo(asnk)
pl.Play
Repeat ' Mientras no se detecte la duración del vídeo, el ciclo continúa
Wait 0.01
Until pl.Duration > 0.00
Print "Duración del vídeo: "; Time(0, 0, 0, pl.Duration * 1000)
tm = Now
Repeat
Write "\r\e[0mTiempo transcurrido: \e[31m" & Str(Time(0, 0, 0, DateDiff(tm, Now, gb.Millisecond)))
Wait 0.01
Until DateDiff(tm, Now, gb.Millisecond) >= (pl.Duration * 1000)
pl.Stop
pl.Close
End
Private Const WEB_TV As String = "https://clubbingtv-rakuten.amagi.tv/playlist720_p.m3u8"
Private bo As Boolean
Public Sub Main()
Dim pl As MediaPipeline
Dim dcb, aa, con, snk As MediaControl
Dim abin, acon, ares, asnk As MediaControl
Dim tm As Date
pl = New MediaPipeline
' Parte vídeo:
dcb = New MediaControl(pl, "uridecodebin")
dcb["uri"] = WEB_TV
aa = New MediaControl(pl, "aatv")
con = New MediaControl(pl, "videoconvert")
snk = New MediaControl(pl, "autovideosink")
dcb.LinkLaterTo(aa)
aa.LinkTo(con)
con.LinkTo(snk)
' Parte audio:
abin = New MediaControl(pl, "uridecodebin")
abin["uri"] = WEB_TV
acon = New MediaControl(pl, "audioconvert")
ares = New MediaControl(pl, "audioresample")
asnk = New MediaControl(pl, "autoaudiosink")
abin.LinkLaterTo(acon)
acon.LinkTo(ares)
ares.LinkTo(asnk)
pl.Play
tm = Now
While Not bo
Write "\r\e[0mTiempo transcurrido: \e[31m" & Str(Time(0, 0, 0, DateDiff(tm, Now, gb.Millisecond)))
Wait 0.01
Wend
pl.Stop
pl.Close
' Después de haber utilizado el evento "Application_Read()", aquí debe usar la instrucción "Quit" para terminar el programa:
Quit
End
' Al hacer clic con el ratón en la consola/terminal y luego presionar la tecla "Enter" del teclado, el programa se completa.
Public Sub Application_Read()
bo = True
End