Android Question New ExoPlayer error in CreateNativePlayer

Yan Paulo

New Member
B4X:
Sub CreateNativePlayer As Object
    
    Dim TrackSelectionFactory As JavaObject
    TrackSelectionFactory.InitializeNewInstance("com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection.Factory", Null)
    Dim TrackSelector As JavaObject
    TrackSelector.InitializeNewInstance("com.google.android.exoplayer2.trackselection.DefaultTrackSelector", Array(TrackSelectionFactory))
    Dim np As JavaObject
    Dim ctxt As JavaObject
    ctxt.InitializeContext
    Dim RenderersFactory As JavaObject
    RenderersFactory.InitializeNewInstance("com.google.android.exoplayer2.DefaultRenderersFactory", Array(ctxt, Null, 1)) 'EXTENSION_RENDERER_MODE_PREFER
    np = np.InitializeStatic("com.google.android.exoplayer2.ExoPlayerFactory").RunMethod("newSimpleInstance", Array(ctxt, RenderersFactory,TrackSelector))
    
    playerInitialized = True
    Return np
End Sub

The error "java.lang.RuntimeException: Constructor not found." occurs on the line:
RenderersFactory.InitializeNewInstance("com.google.android.exoplayer2.DefaultRenderersFactory", Array(ctxt, Null, 1)) 'EXTENSION_RENDERER_MODE_PREFER
 
Top