B4A Library vlcb4a - a B4A wrapper of VLC (Android)

moster67

Expert
Licensed User
Longtime User
I haven't used or looked at this code for ages.
Did you initialize the library?
Does the demo app work?
Upload your related code calling VLC.

As mentioned in the first post, you are probably better off using Exoplayer or my Vitamio wrapper.
 

fathuraa

New Member
Licensed User
I haven't used or looked at this code for ages.
Did you initialize the library?
Does the demo app work?
Upload your related code calling VLC.

As mentioned in the first post, you are probably better off using Exoplayer or my Vitamio wrapper.
this is my code

#Region Project Attributes
#ApplicationLabel: Test Pitch By Options
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region

#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#BridgeLogger:true
#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui As XUI
Dim streamingURL As String 'a process global variable used in this example to pass on the streaming url
End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
Dim VLCVideoview1 As VLCVideoView
Dim VLCMediaController1 As VLCMediaController
Dim posisi As Long
Dim pitch As Long
Private Label1 As Label
Dim currentMono As Int
End Sub

Sub Activity_Create(FirstTime As Boolean)
If FirstTime = True Then
Activity.LoadLayout("Layout")
streamingURL = "http://103.101.225.25:81//lagu/1.mpg" '
VLCVideoview1.Initialize("VLCVideoview1")
'subpanel.Initialize("subpanel") ''for subtitles
currentMono = 3
Activity.AddView(VLCVideoview1,0, 0, 100%x, 50%y)
'mypanel.AddView(subpanel, 0, 0, 100%x, 100%y-20dip) ''for subtitles
VLCMediaController1.Initialize("VLCMediaController1")

Dim OptionList As List
OptionList.Initialize
OptionList.Add("--aout=opensles")
OptionList.Add("--audio-time-stretch")
OptionList.Add("-vvv")
OptionList.Add("--stereo-mode=" & currentMono)
VLCVideoview1.SetVlcOptions(OptionList)
StartStreaming
End If


End Sub

Sub Activity_Resume
VLCVideoview1.Start
End Sub
Sub StartStreaming
'VLCVideoview1.setMute(0,True)

If streamingURL.Contains("http") Then 'streaming url
VLCVideoview1.VideoURI = streamingURL
Else 'local file
VLCVideoview1.SetVideoPath(File.Combine(File.DirAssets,streamingURL))
'for subtitles
'VLCVideoview1.SubtitlesSurfaceView = subpanel
'VLCVideoview1.SubtitleLocalSource = File.Combine(File.DirRootExternal,"bb.srt")

End If

VLCVideoview1.RequestFocus
VLCVideoview1.Start
End Sub
Sub Activity_Pause (UserClosed As Boolean)
VLCVideoview1.Pause
End Sub

Sub Button1_Click
posisi = VLCVideoview1.CurrentPosition
VLCVideoview1.StopPlayback
VLCVideoview1.RemoveView
VLCVideoview1.Initialize("VLCVideoview1")
'subpanel.Initialize("subpanel") ''for subtitles
currentMono = 4
Activity.AddView(VLCVideoview1,0, 0, 100%x, 50%y)
'mypanel.AddView(subpanel, 0, 0, 100%x, 100%y-20dip) ''for subtitles
VLCMediaController1.Initialize("VLCMediaController1")

Dim OptionList As List
OptionList.Initialize
OptionList.Add("--aout=opensles")
OptionList.Add("--audio-time-stretch")
OptionList.Add("-vvv")
OptionList.Add("--stereo-mode=" & currentMono)
OptionList.Add("--start-time=" & (posisi/1000))
VLCVideoview1.SetVlcOptions(OptionList)
Log(posisi)
' VLCVideoview1.SeekTo(posisi)
StartStreaming
End Sub

Private Sub Button2_Click
posisi = VLCVideoview1.CurrentPosition
VLCVideoview1.StopPlayback
VLCVideoview1.RemoveView
VLCVideoview1.Initialize("VLCVideoview1")
'subpanel.Initialize("subpanel") ''for subtitles
currentMono = 3
Activity.AddView(VLCVideoview1,0, 0, 100%x, 50%y)
'mypanel.AddView(subpanel, 0, 0, 100%x, 100%y-20dip) ''for subtitles
VLCMediaController1.Initialize("VLCMediaController1")

Dim OptionList As List
OptionList.Initialize
OptionList.Add("--aout=opensles")
OptionList.Add("--audio-time-stretch")
OptionList.Add("-vvv")
OptionList.Add("--stereo-mode=" & currentMono)
OptionList.Add("--start-time=" & (posisi/1000))
VLCVideoview1.SetVlcOptions(OptionList)
Log(posisi)
' VLCVideoview1.SeekTo(posisi)
StartStreaming

End Sub

Private Sub Button3_Click
'--pitch-shift=5 --audio-filter=scaletempo_pitch
If Label1.Text < 5 Then
Label1.Text = Label1.Text + 1
Else If Label1.Text > 4 Then
Label1.Text = 5
Else If Label1.Text = 5 Then
Label1.Text = 5
Else
Label1.Text = 5
End If
pitch = Label1.Text
' posisi = VLCVideoview1.CurrentPosition
' VLCVideoview1.StopPlayback
' VLCVideoview1.RemoveView
' VLCVideoview1.Initialize("VLCVideoview1")
' 'subpanel.Initialize("subpanel") ''for subtitles
'
' Activity.AddView(VLCVideoview1,0, 0, 100%x, 50%y)
' 'mypanel.AddView(subpanel, 0, 0, 100%x, 100%y-20dip) ''for subtitles
' VLCMediaController1.Initialize("VLCMediaController1")

Dim OptionList As List
OptionList.Initialize
OptionList.Add("--aout=opensles")
'OptionList.Add("--audio-time-stretch")
OptionList.Add("-vvv")
OptionList.Add("--stereo-mode=" & currentMono)
'OptionList.Add("--start-time=" & (posisi/1000))
OptionList.Add("--audio-filter=scaletempo_pitch")
OptionList.Add("--pitch-shift=" & pitch &".0")
'
VLCVideoview1.SetVlcOptions(OptionList)
Log(pitch)
' VLCVideoview1.SeekTo(posisi)
' StartStreaming
End Sub

Private Sub Button4_Click
If Label1.Text > -5 Then
Label1.Text = Label1.Text - 1
Else If Label1.Text < -4 Then
Label1.Text = -5
Else If Label1.Text = -5 Then
Label1.Text = -5
Else
Label1.Text = -5
End If
pitch = Label1.Text
posisi = VLCVideoview1.CurrentPosition
' VLCVideoview1.StopPlayback
' VLCVideoview1.RemoveView
' VLCVideoview1.Initialize("VLCVideoview1")
' 'subpanel.Initialize("subpanel") ''for subtitles
'
' Activity.AddView(VLCVideoview1,0, 0, 100%x, 50%y)
' 'mypanel.AddView(subpanel, 0, 0, 100%x, 100%y-20dip) ''for subtitles
' VLCMediaController1.Initialize("VLCMediaController1")
'
Dim OptionList As List
OptionList.Initialize
OptionList.Add("--aout=opensles")
'OptionList.Add("--audio-time-stretch")
OptionList.Add("-vvv")
OptionList.Add("--stereo-mode=" & currentMono)
'OptionList.Add("--start-time=" & (posisi/1000))
OptionList.Add("--audio-filter=scaletempo_pitch")
OptionList.Add("--pitch-shift=" & pitch)
'
VLCVideoview1.SetVlcOptions(OptionList)
Log(pitch)
' VLCVideoview1.SeekTo(posisi)
' StartStreaming
End Sub
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…