Also check if the Uri is built for raw resource data, and then create the RawResourceDataSource for it.
This commit is contained in:
parent
408bc08682
commit
88f8c768b0
@ -31,6 +31,9 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
* /path/to/media/media.mp4 because the implementation assumes that a URI without a scheme is a
|
* /path/to/media/media.mp4 because the implementation assumes that a URI without a scheme is a
|
||||||
* local file URI).
|
* local file URI).
|
||||||
* <li>asset: For fetching data from an asset in the application's apk (e.g. asset:///media.mp4).
|
* <li>asset: For fetching data from an asset in the application's apk (e.g. asset:///media.mp4).
|
||||||
|
* <li>rawresource: For fetching data from a raw resource in the applications' apk
|
||||||
|
* (e.g. rawresource:///resourceId, where rawResourceId is the integer identifier of the raw
|
||||||
|
* resource).</li>
|
||||||
* <li>content: For fetching data from a content URI (e.g. content://authority/path/123).
|
* <li>content: For fetching data from a content URI (e.g. content://authority/path/123).
|
||||||
* <li>rtmp: For fetching data over RTMP. Only supported if the project using ExoPlayer has an
|
* <li>rtmp: For fetching data over RTMP. Only supported if the project using ExoPlayer has an
|
||||||
* explicit dependency on ExoPlayer's RTMP extension.</li>
|
* explicit dependency on ExoPlayer's RTMP extension.</li>
|
||||||
@ -48,6 +51,7 @@ public final class DefaultDataSource implements DataSource {
|
|||||||
private static final String SCHEME_ASSET = "asset";
|
private static final String SCHEME_ASSET = "asset";
|
||||||
private static final String SCHEME_CONTENT = "content";
|
private static final String SCHEME_CONTENT = "content";
|
||||||
private static final String SCHEME_RTMP = "rtmp";
|
private static final String SCHEME_RTMP = "rtmp";
|
||||||
|
private static final String SCHEME_RAW = RawResourceDataSource.RAW_RESOURCE_SCHEME;
|
||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final TransferListener<? super DataSource> listener;
|
private final TransferListener<? super DataSource> listener;
|
||||||
@ -60,6 +64,7 @@ public final class DefaultDataSource implements DataSource {
|
|||||||
private DataSource contentDataSource;
|
private DataSource contentDataSource;
|
||||||
private DataSource rtmpDataSource;
|
private DataSource rtmpDataSource;
|
||||||
private DataSource dataSchemeDataSource;
|
private DataSource dataSchemeDataSource;
|
||||||
|
private DataSource rawResourceDataSource;
|
||||||
|
|
||||||
private DataSource dataSource;
|
private DataSource dataSource;
|
||||||
|
|
||||||
@ -134,6 +139,8 @@ public final class DefaultDataSource implements DataSource {
|
|||||||
dataSource = getRtmpDataSource();
|
dataSource = getRtmpDataSource();
|
||||||
} else if (DataSchemeDataSource.SCHEME_DATA.equals(scheme)) {
|
} else if (DataSchemeDataSource.SCHEME_DATA.equals(scheme)) {
|
||||||
dataSource = getDataSchemeDataSource();
|
dataSource = getDataSchemeDataSource();
|
||||||
|
} else if (SCHEME_RAW.equals(scheme)) {
|
||||||
|
dataSource = getRawResourceDataSource();
|
||||||
} else {
|
} else {
|
||||||
dataSource = baseDataSource;
|
dataSource = baseDataSource;
|
||||||
}
|
}
|
||||||
@ -213,4 +220,10 @@ public final class DefaultDataSource implements DataSource {
|
|||||||
return dataSchemeDataSource;
|
return dataSchemeDataSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DataSource getRawResourceDataSource() {
|
||||||
|
if (rawResourceDataSource == null) {
|
||||||
|
rawResourceDataSource = new RawResourceDataSource(context, listener);
|
||||||
|
}
|
||||||
|
return rawResourceDataSource;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user