B4A Library ExoPlayerTextureView

This is a wrap for this github project.

ExoPlayerTextureView
Author:
DonManfred (wrapper)
Version: 1
  • VideoSource
    Methods:
    • Initialize (EventName As String, url As String, userAgent As String, bufferSegmentSize As Int, bufferSegmentCount As Int) As HlsVideoSource
    • IsInitialized As Boolean
    Permissions:
    • android.permission.ACCESS_NETWORK_STATE
    • android.permission.INTERNET
  • VideoTexturePresenter
    Events:
    • onError (error As String)
    • onStateChanged (playWhenReady As Boolean, playbackState As Int)
    • onVideoSizeChanged (width As Int, height As Int, pixelWidthHeightRatio As Float)
    Methods:
    • Initialize (EventName As String, view As VideoTextureView)
    • IsInitialized As Boolean
    • clearAllOnStateChangedListener
    • eventListeners As EventProxy
    • isPlaying As Boolean
    • onCreate
    • onDestroy
    • pause
    • play
    • prepare
    • release
    • seekTo (positionMs As Long)
    • stop
    Properties:
    • BufferedPercentage As Int [read only]
    • BufferedPosition As Long [read only]
    • CurrentPosition As Long [read only]
    • Duration As Long [read only]
    • LimitBitrate As Long [write only]
    • Mute As Boolean [write only]
    • PlaybackState As Int [read only]
    • Source As VideoSource [write only]
  • VideoTextureView
    Fields:
    • ba As BA
    Methods:
    • BringToFront
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • 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
    • RemoveView
    • RequestFocus As Boolean
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 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)
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • Parent As Object [read only]
    • Tag As Object
    • Top As Int
    • VideoWidthHeightRatio As Float [write only]
      Set the aspect ratio that this {@link VideoTextureView} should satisfy.
    • Visible As Boolean
    • Width As Int

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private VideoTextureView1 As VideoTextureView
    Dim presenter As VideoTexturePresenter
    Dim source As VideoSource
End Sub
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Layout1")
    presenter.Initialize("Presenter",VideoTextureView1)
    presenter.Source = source.Initialize("Source","http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8","agent",64*1024,512)
End Sub
Sub Presenter_onError(error As String)
    Log($"onError(${error})"$)
End Sub
Sub Presenter_onStateChanged(playWhenReady As Boolean, playbackState As Int)
    Log($"onStateChanged(${playWhenReady},${playbackState})"$) 
End Sub
Sub Presenter_onVideoSizeChanged(width As Int, height As Int, pixelWidthHeightRatio As Float)
    Log($"onVideoSizeChanged(${width}x${height},${pixelWidthHeightRatio})"$)     
End Sub
Sub Activity_Resume
    presenter.play
End Sub
Sub Activity_Pause (UserClosed As Boolean)
    presenter.pause
End Sub

Screenshot_20160628-222806.png


This Library is, as of the info on github, Experimental. Don´t expect much here. I just tried to do a wrap for it to see if it works...

Please note It is using an old version of the player. V1.5.9

You need a aar (the player) additional to this lib. Download here

So, here it is. Have fun with it :)
 

Attachments

  • ExoPlayerTextureViewEx.zip
    7.9 KB · Views: 521
  • ExoPlayerTextureViewV1.0.zip
    35.5 KB · Views: 501

susu

Well-Known Member
Licensed User
Longtime User
Hi @DonManfred ,

I download your lib, exoplayer-r1.5.9.aar and your sample project but when I test there's no video and the log is empty too. I'm using B4A 6.0. Do you have any idea? Thanks.
 

susu

Well-Known Member
Licensed User
Longtime User
I used your sample code so manifest is unchanged. My device is using Android 5.1.1.
 

wxws

Member
Licensed User
Longtime User
Hi @DonManfred ,

I download your lib, exoplayer-r1.5.9.aar and your sample project but when I test there's no video and the log is empty too. I'm using B4A 6.0. Do you have any idea? Thanks.

manifest file add:

'End of default text.
AddPermission("android.permission.INTERNET")
AddPermission("android.permission.ACCESS_NETWORK_STATE")


the 1# demo is not add it.
 

MAGAREY

Member
Licensed User
Longtime User
i have an odd issue, when i add the source, and play it , i can hear the sound but i can't see anything, i doing something wrong?
 
Top