Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
NotesChapter
ExoPlayer
提交
13b46dab
E
ExoPlayer
项目概览
NotesChapter
/
ExoPlayer
与 Fork 源项目一致
从无法访问的项目Fork
通知
6
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
ExoPlayer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
13b46dab
编写于
1月 24, 2018
作者:
O
ojw28
提交者:
GitHub
1月 24, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3719 from eneim/improve/raw-resource
Improve raw resource data source (recreated)
上级
a1274591
88f8c768
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
1 deletion
+14
-1
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultDataSource.java
...google/android/exoplayer2/upstream/DefaultDataSource.java
+13
-0
library/core/src/main/java/com/google/android/exoplayer2/upstream/RawResourceDataSource.java
...le/android/exoplayer2/upstream/RawResourceDataSource.java
+1
-1
未找到文件。
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultDataSource.java
浏览文件 @
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
浏览文件 @
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
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录