Android Question Exoplayer url video with header authentication?

Erel

B4X founder
Staff member
Licensed User
Longtime User
Try this:
B4X:
Dim source As JavaObject = player.CreateUriSource("https//www....")
Dim r As Reflector
r.Target = source
r.Target = r.GetField("dataSourceFactory")
Dim jo As JavaObject = r.GetField("baseDataSourceFactory")
Dim requestProperties As JavaObject = jo.RunMethod("getDefaultRequestProperties", Null)
requestProperties.RunMethod("set", Array("Authorization", "value"))
player.Prepare(source)
 
Upvote 0

tuhatinhvn

Active Member
Licensed User
Longtime User
Try this:
B4X:
Dim source As JavaObject = player.CreateUriSource("https//www....")
Dim r As Reflector
r.Target = source
r.Target = r.GetField("dataSourceFactory")
Dim jo As JavaObject = r.GetField("baseDataSourceFactory")
Dim requestProperties As JavaObject = jo.RunMethod("getDefaultRequestProperties", Null)
requestProperties.RunMethod("set", Array("Authorization", "value"))
player.Prepare(source)
Thank you for your code, can we set header (exam user-agent) for exoplayer too?
 
Upvote 0

Shalu Samtani

Member
Licensed User
Longtime User
Try this:
B4X:
Dim source As JavaObject = player.CreateUriSource("https//www....")
Dim r As Reflector
r.Target = source
r.Target = r.GetField("dataSourceFactory")
Dim jo As JavaObject = r.GetField("baseDataSourceFactory")
Dim requestProperties As JavaObject = jo.RunMethod("getDefaultRequestProperties", Null)
requestProperties.RunMethod("set", Array("Authorization", "value"))
player.Prepare(source)
Thank You
 
Upvote 0
Top