Note: HTTP request headers will be set using all parameters passed via (in order of decreasing
+ * priority) the {@code dataSpec}, {@link #setRequestProperty} and the default parameters used to
+ * construct the instance.
+ */
+ public static class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
+
+ static {
+ MediaLibraryInfo.registerModule("goog.exo.okhttp");
+ }
+
+ private final Call.Factory callFactory;
+ private final RequestProperties requestProperties;
+ @Nullable
+ private final String userAgent;
+ @Nullable
+ private final CacheControl cacheControl;
+ @Nullable
+ private final RequestProperties defaultRequestProperties;
+ @Nullable
+ private Predicate This method blocks until at least one byte of data can be read, the end of the opened range
+ * is detected, or an exception is thrown.
+ *
+ * @param buffer The buffer into which the read data should be stored.
+ * @param offset The start offset into {@code buffer} at which data should be written.
+ * @param readLength The maximum number of bytes to read.
+ * @return The number of bytes read, or {@link C#RESULT_END_OF_INPUT} if the end of the opened
+ * range is reached.
+ * @throws IOException If an error occurs reading from the source.
+ */
+ private int readInternal(byte[] buffer, int offset, int readLength) throws IOException {
+ if (readLength == 0) {
+ return 0;
+ }
+ if (bytesToRead != C.LENGTH_UNSET) {
+ long bytesRemaining = bytesToRead - bytesRead;
+ if (bytesRemaining == 0) {
+ return C.RESULT_END_OF_INPUT;
+ }
+ readLength = (int) min(readLength, bytesRemaining);
+ }
+
+ int read = castNonNull(responseByteStream).read(buffer, offset, readLength);
+ if (read == -1) {
+ return C.RESULT_END_OF_INPUT;
+ }
+
+ bytesRead += read;
+ bytesTransferred(read);
+ return read;
+ }
+
+ /**
+ * Closes the current connection quietly, if there is one.
+ */
+ private void closeConnectionQuietly() {
+ if (response != null) {
+ Assertions.checkNotNull(response.body()).close();
+ response = null;
+ }
+ responseByteStream = null;
+ }
+
+ @UnstableApi
+ /** {@link DataSource.Factory} for {@link OkHttpDataSource} instances. */
+ public static final class Factory implements HttpDataSource.Factory {
+
+ private final RequestProperties defaultRequestProperties;
+ private final Call.Factory callFactory;
+
+ @Nullable
+ private String userAgent;
+ @Nullable
+ private TransferListener transferListener;
+ @Nullable
+ private CacheControl cacheControl;
+ @Nullable
+ private Predicate The default is {@code null}, which causes the default user agent of the underlying {@link
+ * OkHttpClient} to be used.
+ *
+ * @param userAgent The user agent that will be used, or {@code null} to use the default user
+ * agent of the underlying {@link OkHttpClient}.
+ * @return This factory.
+ */
+ public Factory setUserAgent(@Nullable String userAgent) {
+ this.userAgent = userAgent;
+ return this;
+ }
+
+ /**
+ * Sets the {@link CacheControl} that will be used.
+ *
+ * The default is {@code null}.
+ *
+ * @param cacheControl The cache control that will be used.
+ * @return This factory.
+ */
+ public Factory setCacheControl(@Nullable CacheControl cacheControl) {
+ this.cacheControl = cacheControl;
+ return this;
+ }
+
+ /**
+ * Sets a content type {@link Predicate}. If a content type is rejected by the predicate then a
+ * {@link InvalidContentTypeException} is thrown from {@link
+ * OkHttpDataSource#open(DataSpec)}.
+ *
+ * The default is {@code null}.
+ *
+ * @param contentTypePredicate The content type {@link Predicate}, or {@code null} to clear a
+ * predicate that was previously set.
+ * @return This factory.
+ */
+ public Factory setContentTypePredicate(@Nullable Predicate The default is {@code null}.
+ *
+ * See {@link DataSource#addTransferListener(TransferListener)}.
+ *
+ * @param transferListener The listener that will be used.
+ * @return This factory.
+ */
+ public Factory setTransferListener(@Nullable TransferListener transferListener) {
+ this.transferListener = transferListener;
+ return this;
+ }
+
+ @Override
+ public OkHttpDataSource createDataSource() {
+ OkHttpDataSource dataSource =
+ new OkHttpDataSource(
+ callFactory, userAgent, cacheControl, defaultRequestProperties, contentTypePredicate);
+ if (transferListener != null) {
+ dataSource.addTransferListener(transferListener);
+ }
+ return dataSource;
+ }
+ }
+ }
}
diff --git a/app/src/main/java/com/google/androidx/media3/exoplayer/ext/okhttp/OkHttpDataSource.java b/app/src/main/java/okhttp3/OkHttpDataSource.java
similarity index 99%
rename from app/src/main/java/com/google/androidx/media3/exoplayer/ext/okhttp/OkHttpDataSource.java
rename to app/src/main/java/okhttp3/OkHttpDataSource.java
index 70d649d..20ca262 100644
--- a/app/src/main/java/com/google/androidx/media3/exoplayer/ext/okhttp/OkHttpDataSource.java
+++ b/app/src/main/java/okhttp3/OkHttpDataSource.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.google.androidx.media3.exoplayer.ext.okhttp;
+package okhttp3;
import static androidx.media3.common.util.Util.castNonNull;
@@ -537,4 +537,4 @@ public OkHttpDataSource createDataSource() {
return dataSource;
}
}
-}
+}
\ No newline at end of file
diff --git a/app/src/main/java/xyz/doikki/videoplayer/exo/ExoMediaSourceHelper.java b/app/src/main/java/xyz/doikki/videoplayer/exo/ExoMediaSourceHelper.java
index abe4aa3..d0a45b3 100644
--- a/app/src/main/java/xyz/doikki/videoplayer/exo/ExoMediaSourceHelper.java
+++ b/app/src/main/java/xyz/doikki/videoplayer/exo/ExoMediaSourceHelper.java
@@ -29,13 +29,14 @@
import androidx.media3.extractor.ts.DefaultTsPayloadReaderFactory;
import androidx.media3.extractor.ts.TsExtractor;
-import com.google.androidx.media3.exoplayer.ext.okhttp.OkHttpDataSource;
+
import java.io.File;
import java.lang.reflect.Field;
import java.util.Map;
import okhttp3.OkHttpClient;
+import okhttp3.OkHttpDataSource;
public final class ExoMediaSourceHelper {
diff --git a/app/src/main/java/xyz/doikki/videoplayer/exo/MyBundledHlsMediaChunkExtractor.java b/app/src/main/java/xyz/doikki/videoplayer/exo/MyBundledHlsMediaChunkExtractor.java
index 3dbe66b..a06d0f3 100644
--- a/app/src/main/java/xyz/doikki/videoplayer/exo/MyBundledHlsMediaChunkExtractor.java
+++ b/app/src/main/java/xyz/doikki/videoplayer/exo/MyBundledHlsMediaChunkExtractor.java
@@ -17,7 +17,7 @@
import androidx.media3.extractor.ts.Ac4Extractor;
import androidx.media3.extractor.ts.AdtsExtractor;
-import com.google.androidx.media3.exoplayer.extractor.ts.MyTsExtractor;
+
import java.io.IOException;
diff --git a/app/src/main/java/xyz/doikki/videoplayer/exo/MyHlsExtractorFactory.java b/app/src/main/java/xyz/doikki/videoplayer/exo/MyHlsExtractorFactory.java
index 6f8e56a..444136b 100644
--- a/app/src/main/java/xyz/doikki/videoplayer/exo/MyHlsExtractorFactory.java
+++ b/app/src/main/java/xyz/doikki/videoplayer/exo/MyHlsExtractorFactory.java
@@ -27,7 +27,7 @@
import androidx.media3.extractor.ts.AdtsExtractor;
import androidx.media3.extractor.ts.DefaultTsPayloadReaderFactory;
-import com.google.androidx.media3.exoplayer.extractor.ts.MyTsExtractor;
+
import com.google.common.primitives.Ints;
import java.io.EOFException;
diff --git a/app/src/main/java/com/google/androidx/media3/exoplayer/extractor/ts/MyTsExtractor.java b/app/src/main/java/xyz/doikki/videoplayer/exo/MyTsExtractor.java
similarity index 98%
rename from app/src/main/java/com/google/androidx/media3/exoplayer/extractor/ts/MyTsExtractor.java
rename to app/src/main/java/xyz/doikki/videoplayer/exo/MyTsExtractor.java
index e9021d3..117d0a2 100644
--- a/app/src/main/java/com/google/androidx/media3/exoplayer/extractor/ts/MyTsExtractor.java
+++ b/app/src/main/java/xyz/doikki/videoplayer/exo/MyTsExtractor.java
@@ -1,19 +1,5 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.google.androidx.media3.exoplayer.extractor.ts;
+package xyz.doikki.videoplayer.exo;
+
import static androidx.media3.extractor.ts.TsPayloadReader.FLAG_PAYLOAD_UNIT_START_INDICATOR;
diff --git a/app/src/main/java/com/google/androidx/media3/exoplayer/extractor/ts/TsBinarySearchSeeker.java b/app/src/main/java/xyz/doikki/videoplayer/exo/TsBinarySearchSeeker.java
similarity index 91%
rename from app/src/main/java/com/google/androidx/media3/exoplayer/extractor/ts/TsBinarySearchSeeker.java
rename to app/src/main/java/xyz/doikki/videoplayer/exo/TsBinarySearchSeeker.java
index 3a7e873..2d48bf9 100644
--- a/app/src/main/java/com/google/androidx/media3/exoplayer/extractor/ts/TsBinarySearchSeeker.java
+++ b/app/src/main/java/xyz/doikki/videoplayer/exo/TsBinarySearchSeeker.java
@@ -1,4 +1,4 @@
-package com.google.androidx.media3.exoplayer.extractor.ts;
+package xyz.doikki.videoplayer.exo;
import androidx.media3.extractor.ExtractorInput;
import androidx.media3.extractor.PositionHolder;
diff --git a/app/src/main/java/com/google/androidx/media3/exoplayer/extractor/ts/TsDurationReader.java b/app/src/main/java/xyz/doikki/videoplayer/exo/TsDurationReader.java
similarity index 89%
rename from app/src/main/java/com/google/androidx/media3/exoplayer/extractor/ts/TsDurationReader.java
rename to app/src/main/java/xyz/doikki/videoplayer/exo/TsDurationReader.java
index 55f7327..f94efa2 100644
--- a/app/src/main/java/com/google/androidx/media3/exoplayer/extractor/ts/TsDurationReader.java
+++ b/app/src/main/java/xyz/doikki/videoplayer/exo/TsDurationReader.java
@@ -1,4 +1,4 @@
-package com.google.androidx.media3.exoplayer.extractor.ts;
+package xyz.doikki.videoplayer.exo;
import androidx.media3.extractor.ExtractorInput;
import androidx.media3.extractor.PositionHolder;
diff --git a/app/version.properties b/app/version.properties
index 2ddc001..1e62ffe 100644
--- a/app/version.properties
+++ b/app/version.properties
@@ -1,2 +1,2 @@
-#Fri Sep 22 14:54:55 CST 2023
-VERSION_CODE=2023092206
+#Sun Sep 24 15:39:28 CST 2023
+VERSION_CODE=2023092209
diff --git a/build.gradle b/build.gradle
index 9b6c219..a24d4ef 100644
--- a/build.gradle
+++ b/build.gradle
@@ -34,8 +34,11 @@ ext {
compileSdkVersion = 33
minSdkVersion = 18
targetSdkVersion = 29
- exoVersion = "2.19.1"
+ gsonVersion = '2.10.1'
+ jsoupVersion = '1.15.3'
media3Version = '1.1.1'
+ okhttpVersion = '4.11.0'
+ annotationVersion = '1.3.0'
}
task clean(type: Delete) {
delete rootProject.buildDir
diff --git a/settings.gradle b/settings.gradle
index cdf1fe8..b465df7 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -2,4 +2,5 @@ rootProject.name = "HE影"
include ':app'
include ':quickjs'
include ':pyramid'
-//include ':player'
\ No newline at end of file
+//include ':ijkplayer'
+//include ':catvod'
\ No newline at end of file