Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
13b46dab
authored
Jan 24, 2018
by
ojw28
Committed by
GitHub
Jan 24, 2018
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge pull request #3719 from eneim/improve/raw-resource
Improve raw resource data source (recreated)
parents
a1274591
88f8c768
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletions
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultDataSource.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/RawResourceDataSource.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultDataSource.java
View file @
13b46dab
...
...
@@ -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
* local file URI).
* <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>rtmp: For fetching data over RTMP. Only supported if the project using ExoPlayer has an
* 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_CONTENT
=
"content"
;
private
static
final
String
SCHEME_RTMP
=
"rtmp"
;
private
static
final
String
SCHEME_RAW
=
RawResourceDataSource
.
RAW_RESOURCE_SCHEME
;
private
final
Context
context
;
private
final
TransferListener
<?
super
DataSource
>
listener
;
...
...
@@ -60,6 +64,7 @@ public final class DefaultDataSource implements DataSource {
private
DataSource
contentDataSource
;
private
DataSource
rtmpDataSource
;
private
DataSource
dataSchemeDataSource
;
private
DataSource
rawResourceDataSource
;
private
DataSource
dataSource
;
...
...
@@ -134,6 +139,8 @@ public final class DefaultDataSource implements DataSource {
dataSource
=
getRtmpDataSource
();
}
else
if
(
DataSchemeDataSource
.
SCHEME_DATA
.
equals
(
scheme
))
{
dataSource
=
getDataSchemeDataSource
();
}
else
if
(
SCHEME_RAW
.
equals
(
scheme
))
{
dataSource
=
getRawResourceDataSource
();
}
else
{
dataSource
=
baseDataSource
;
}
...
...
@@ -213,4 +220,10 @@ public final class DefaultDataSource implements DataSource {
return
dataSchemeDataSource
;
}
private
DataSource
getRawResourceDataSource
()
{
if
(
rawResourceDataSource
==
null
)
{
rawResourceDataSource
=
new
RawResourceDataSource
(
context
,
listener
);
}
return
rawResourceDataSource
;
}
}
library/core/src/main/java/com/google/android/exoplayer2/upstream/RawResourceDataSource.java
View file @
13b46dab
...
...
@@ -58,7 +58,7 @@ public final class RawResourceDataSource implements DataSource {
return
Uri
.
parse
(
RAW_RESOURCE_SCHEME
+
":///"
+
rawResourceId
);
}
p
rivate
static
final
String
RAW_RESOURCE_SCHEME
=
"rawresource"
;
p
ublic
static
final
String
RAW_RESOURCE_SCHEME
=
"rawresource"
;
private
final
Resources
resources
;
private
final
TransferListener
<?
super
RawResourceDataSource
>
listener
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment