|
|
|
|
@ -7,6 +7,7 @@ import androidx.media3.common.MediaItem; |
|
|
|
|
import androidx.media3.common.MimeTypes; |
|
|
|
|
import androidx.media3.common.PlaybackException; |
|
|
|
|
import androidx.media3.common.Tracks; |
|
|
|
|
import androidx.media3.common.util.Util; |
|
|
|
|
import androidx.media3.database.DatabaseProvider; |
|
|
|
|
import androidx.media3.database.StandaloneDatabaseProvider; |
|
|
|
|
import androidx.media3.datasource.DataSource; |
|
|
|
|
@ -34,7 +35,6 @@ import com.fongmi.android.tv.bean.Result; |
|
|
|
|
import com.fongmi.android.tv.bean.Sub; |
|
|
|
|
import com.fongmi.android.tv.utils.FileUtil; |
|
|
|
|
import com.fongmi.android.tv.utils.Prefers; |
|
|
|
|
import com.fongmi.android.tv.utils.Sniffer; |
|
|
|
|
import com.google.common.net.HttpHeaders; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
@ -108,7 +108,7 @@ public class ExoUtil { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static synchronized DataSource.Factory getDataSourceFactory(Map<String, String> headers) { |
|
|
|
|
if (!headers.containsKey(HttpHeaders.USER_AGENT)) headers.put(HttpHeaders.USER_AGENT, Sniffer.CHROME); |
|
|
|
|
if (!headers.containsKey(HttpHeaders.USER_AGENT)) headers.put(HttpHeaders.USER_AGENT, Util.getUserAgent(App.get(), App.get().getPackageName())); |
|
|
|
|
if (dataSourceFactory == null) dataSourceFactory = buildReadOnlyCacheDataSource(new DefaultDataSource.Factory(App.get(), getHttpDataSourceFactory()), getCache()); |
|
|
|
|
httpDataSourceFactory.setDefaultRequestProperties(headers); |
|
|
|
|
return dataSourceFactory; |
|
|
|
|
|