mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-08-04 10:36:56 +00:00
add headers
This commit is contained in:
parent
2edd505e12
commit
c50f52bfc2
1 changed files with 9 additions and 1 deletions
|
|
@ -7,6 +7,14 @@ import androidx.media3.datasource.DefaultHttpDataSource
|
|||
import com.nuvio.app.features.trailer.YoutubeChunkedDataSourceFactory
|
||||
|
||||
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>,
|
||||
|
|
@ -18,7 +26,7 @@ internal object PlatformPlaybackDataSourceFactory {
|
|||
} else {
|
||||
DefaultHttpDataSource.Factory()
|
||||
.setAllowCrossProtocolRedirects(true)
|
||||
.setDefaultRequestProperties(defaultRequestHeaders)
|
||||
.setDefaultRequestProperties(DEFAULT_STREAM_HEADERS + defaultRequestHeaders)
|
||||
}
|
||||
val baseFactory: DataSource.Factory = DefaultDataSource.Factory(context, networkFactory)
|
||||
return if (defaultResponseHeaders.isEmpty()) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue