The following summary presents the current status of the wrapper (version 0.77 of 27/06/2016):
vlcb4a
Author: Mikael Osterhed aka moster67
Version: 0.77
- VLCMediaController
Events:
- onMediaControllerHidden
- onMediaControllerShown
- Fields:
- ba As BA
- Methods:
- BringToFront
- Hide
Hide the controller on screen.
- Initialize (EventName As String)
- Invalidate
- Invalidate2 (arg0 As Rect)
- Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- IsInitialized As Boolean
- IsShowing As Boolean
- RemoveView
- RequestFocus As Boolean
- SendToBack
- SetBackgroundImage (arg0 As Bitmap)
- SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
- SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- Show
Shows the controller on screen.
It will go away automatically after a default 3000 milliseconds of inactivity.
- Show2 (Timeout As Int)
Shows the controller on screen.
It will go away automatically after 'timeout' milliseconds of inactivity.
Use 0 to show the controller until hide() is called.
- Properties:
- Background As Drawable
- Color As Int [write only]
- Enabled As Boolean [read only]
- Parent As Object [read only]
- Tag As Object
- Visible As Boolean
- VLCVideoView
Events:
- onCompleted
- onError
- onPrepared
- Fields:
- VOLUME_MUSIC As Int
- VOLUME_VOICE_CALL As Int
- ba As BA
- Methods:
- BringToFront
- CanSeekBackward As Boolean
Verifies if the media can seek backward.
- CanSeekForward As Boolean
Verifies if the media can seek forward.
- Initialize (EventName As String)
- Invalidate
- Invalidate2 (arg0 As Rect)
- Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- IsInitialized As Boolean
- IsPlaying As Boolean
Tests whether the video is currently playing.
- Pause
Pauses the playback.
- RemoveView
- RequestFocus As Boolean
- Resume
Resumes the playback.
- SeekTo (Milliseconds As Int)
Seeks to specified time position. Parameters: Milliseconds - the offset in milliseconds from the start to seek to.
- SendToBack
- SetBackgroundImage (arg0 As Bitmap)
- SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
- SetLayout (Top As Int, Left As Int, Width As Int, Height As Int)
- SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
- SetMediaController (MediaController1 As ExtMediaPlayerControl)
Sets the MediaController. Video must be prepared state to set it (use onPrepared).
To disable MediaController, set it to null.
- SetVideoPath (VideoPath As String)
Sets the local file path of the video to play.
example:
SetVideoPath(File.Combine(File.DirRootExternal, "test_video.mp4"))
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- SetVlcOptions (VlcOptions As ArrayList)
Sets various VLC options. Must be set before calling VideoURI or SetVideoPath.
If you don't want any options, either don't call this method or pass null as value.
Options must be passed on in a list as strings.
Some options that are available:
--aout=opensles
--audio-time-stretch 'time stretching
-vvv 'verbosity
example:
Dim OptionList As List
OptionList.Initialize
OptionList.Add("--aout=opensles")
OptionList.Add("--audio-time-stretch")
VLCVideoView1.SetVlcOptions(OptionList)
- Start
Starts or resumes playing.
- StopPlayback
Stops the playback.
- currentVideoSize As Int
Returns current video-size.
- getMaxVolume (channel As Int) As Int
gets Max Volume for device and type of audio
based on AudioManager
- getVolume (channel As Int) As Int
gets current Volume level
based on AudioManager
- resizeVideo
Resizes the video.
- setMute (channel As Int, state As Boolean)
Enable or disable mute-status
true = ON, false = off
based on AudioManager
- setVolume (channel As Int, level As Int)
sets Volume level. You need to get Max volume
first to know the range available
Range: zero(0) to MaxVolume
based on AudioManager
- Permissions:
- android.permission.INTERNET
- android.permission.WAKE_LOCK
- Properties:
- AudioTrack As Int [write only]
Sets selected AudioTrack.
- AudioTrackDesc As MyMap [read only]
Returns a description of the AudioTracks.
Values returned are: id and name
id is used for setting which AudioTrack to play.
The values are available when the video is playing.
Assign the map to a map of your own.
example:
Dim audiotracks As Map = VLCVideoView1.AudioTrackDesc
- AudioTracksCount As Int [read only]
Returns number of AudioTracks.
- Background As Drawable
- Color As Int [write only]
- CurrentPosition As Long [read only]
Returns the current playback position in units of milliseconds.
- Duration As Long [read only]
Returns the video duration in milliseconds.
- Enabled As Boolean
- Height As Int
- Left As Int
- Parent As Object [read only]
- Position As Long
Gets or sets the playing position (in milliseconds).
- SubtitleLocalSource As String [write only]
Sets a local subtitle source (.srt).
example:
SetVideoPath(File.Combine(File.DirRootExternal, "sub.srt"))
- SubtitleTrack As Int [write only]
Sets selected SubtitleTrack.
- SubtitlesCount As Int [read only]
Returns number of Subtitles.
- SubtitlesDesc As MyMap [read only]
Returns a description of the SubtitleTracks.
Values returned are: id and name
id is used for setting which SubtitleTrack to show.
The values are available when the video is playing.
Assign the map to a map of your own.
example:
Dim Subtitletracks As Map = VLCVideoView1.SubtitlesDesc
- SubtitlesSurfaceView As ViewGroup [write only]
Takes B4A panel (ViewGroup) and adds a SurfaceView
to use as a panel for the subtitles.
example:
in Globals
Dim subpanel As Panel 'for subtitles
in Activity_Create
subpanel.Initialize("subpanel")
mypanel.AddView(VLCVideoview1,0, 0, 100%x, 100%y)
mypanel.AddView(subpanel, 0, 0, 100%x, 100%y-20dip)
VLCVideoview1.SubtitlesSurfaceView = subpanel
VLCVideoview1.SubtitleLocalSource = File.Combine(File.DirRootExternal,"bb.srt")
- Tag As Object
- Top As Int
- VideoSize As Int [write only]
Sets Video size. Available values are:
SURFACE_BEST_FIT = 0, SURFACE_FIT_HORIZONTAL = 1,
SURFACE_FIT_VERTICAL = 2, SURFACE_FILL = 3,
SURFACE_16_9 = 4, SURFACE_4_3 = 5,
SURFACE_ORIGINAL = 6
Default video size is SURFACE_BEST_FIT = 0
- VideoURI As String [write only]
Sets the URI stream of the video to play.
example:
VideoURI = "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"
VideoURI = "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"
- Visible As Boolean
- Volume As Int [write only]
Sets volume as integer
This is the native volume control and is not based on AudioManager.
This control has been reported to have problems. If you have problems
you can use the other volume methods available based on AudioManager.
Range should be 0-200.
At 40 it seems to become hearable, above 100 it might cause distortion
- Width As Int
i tried to add SetVlcOptions --audio-filter=scaletempo_pitch --pitch-shift=5 why error
Logger connected to: samsung SM-A705F
--------- beginning of crash
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Surfaceview is null
2702
Surfaceview is null
5705
Surfaceview is null
** Activity (main) Pause, UserClosed = false **
** Service (starter) Destroy (ignored)**
--------- beginning of system
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Surfaceview is null
1
main_startstreaming (java line: 640)
java.lang.IllegalStateException: can't create LibVLC instance
at org.videolan.libvlc.LibVLC.nativeNew(Native Method)
at org.videolan.libvlc.LibVLC.<init>(LibVLC.java:85)
at org.videolan.libvlc.media.VideoView.initLibVLC(VideoView.java:146)
at org.videolan.libvlc.media.VideoView.setVideoURI(VideoView.java:274)
at com.tillekesoft.vlcb4a.VideoViewWrapper.setVideoURI(VideoViewWrapper.java:238)
at b4a.examplekaraoke.main._startstreaming(main.java:640)
at b4a.examplekaraoke.main._button3_click(main.java:536)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:8160)
at android.widget.TextView.performClick(TextView.java:16222)
at android.view.View.performClickInternal(View.java:8137)
at android.view.View.access$3700(View.java:888)
at android.view.View$PerformClick.run(View.java:30236)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8653)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Surfaceview is null
1901
Surfaceview is null
1
Error occurred on line: 64 (Main)
java.lang.IllegalStateException: can't create LibVLC instance
at org.videolan.libvlc.LibVLC.nativeNew(Native Method)
at org.videolan.libvlc.LibVLC.<init>(LibVLC.java:85)
at org.videolan.libvlc.media.VideoView.initLibVLC(VideoView.java:146)
at org.videolan.libvlc.media.VideoView.setVideoURI(VideoView.java:274)
at com.tillekesoft.vlcb4a.VideoViewWrapper.setVideoURI(VideoViewWrapper.java:238)
at b4a.examplekaraoke.main._startstreaming(main.java:457)
at b4a.examplekaraoke.main._button3_click(main.java:707)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:197)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:8160)
at android.widget.TextView.performClick(TextView.java:16222)
at android.view.View.performClickInternal(View.java:8137)
at android.view.View.access$3700(View.java:888)
at android.view.View$PerformClick.run(View.java:30236)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8653)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)