B4A Library ExoPlayerTextureView

Discussion in 'Additional libraries, classes and official updates' started by DonManfred, Jun 28, 2016.

  1. DonManfred

    DonManfred Expert Licensed User

    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

    Code:
    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 :)
     

    Attached Files:

    JordiCP, susu, Almora and 8 others like this.
  2. moster67

    moster67 Expert Licensed User

    Nice one!
     
  3. MarcoRome

    MarcoRome Expert Licensed User

    Again another great work +30 ;)
     
  4. susu

    susu Well-Known Member Licensed 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.
     
  5. DonManfred

    DonManfred Expert Licensed User

    I just tried the sample again. works fine here (again).
    What Android Version does the device have which you use?
    what targetsdk is set in manifest?
     
  6. susu

    susu Well-Known Member Licensed User

    I used your sample code so manifest is unchanged. My device is using Android 5.1.1.
     
  7. wxws

    wxws Member Licensed User

    manifest file add:

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


    the 1# demo is not add it.
     
    susu likes this.
  8. MAGAREY

    MAGAREY Member Licensed User

    It's possible to implement subtitles?
     
  9. DonManfred

    DonManfred Expert Licensed User

    I do not have the source anymore.
    Sorry but no.
     
  10. MAGAREY

    MAGAREY Member Licensed 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?
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice