mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-08-02 01:28:25 +00:00
add headers
This commit is contained in:
parent
c50f52bfc2
commit
b681a899f7
1 changed files with 9 additions and 1 deletions
|
|
@ -6,6 +6,14 @@ import androidx.media3.datasource.DefaultDataSource
|
|||
import androidx.media3.datasource.DefaultHttpDataSource
|
||||
|
||||
internal object PlatformPlaybackDataSourceFactory {
|
||||
|
||||
private val DEFAULT_STREAM_HEADERS = mapOf(
|
||||
"User-Agent" to "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " +
|
||||
"AppleWebKit/537.36 (KHTML, like Gecko) " +
|
||||
"Chrome/120.0.0.0 Safari/537.36",
|
||||
"Referer" to "https://www.strem.io/"
|
||||
)
|
||||
|
||||
fun create(
|
||||
context: Context,
|
||||
defaultRequestHeaders: Map<String, String>,
|
||||
|
|
@ -14,7 +22,7 @@ internal object PlatformPlaybackDataSourceFactory {
|
|||
): DataSource.Factory {
|
||||
val httpFactory = DefaultHttpDataSource.Factory()
|
||||
.setAllowCrossProtocolRedirects(true)
|
||||
.setDefaultRequestProperties(defaultRequestHeaders)
|
||||
.setDefaultRequestProperties(DEFAULT_STREAM_HEADERS + defaultRequestHeaders)
|
||||
val baseFactory: DataSource.Factory = DefaultDataSource.Factory(context, httpFactory)
|
||||
return if (defaultResponseHeaders.isEmpty()) {
|
||||
baseFactory
|
||||
|
|
|
|||
Loading…
Reference in a new issue