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
3e62b63e
authored
May 22, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Try and use httpDataSource if scheme isn't recognised.
Issue: #473
parent
253a0105
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
26 deletions
library/src/main/java/com/google/android/exoplayer/upstream/DefaultUriDataSource.java
library/src/main/java/com/google/android/exoplayer/upstream/DefaultUriDataSource.java
View file @
3e62b63e
...
...
@@ -36,28 +36,6 @@ import java.io.IOException;
*/
public
final
class
DefaultUriDataSource
implements
UriDataSource
{
/**
* Thrown when a {@link DefaultUriDataSource} is opened for a URI with an unsupported scheme.
*/
public
static
final
class
UnsupportedSchemeException
extends
IOException
{
/**
* The unsupported scheme.
*/
public
final
String
scheme
;
/**
* @param scheme The unsupported scheme.
*/
public
UnsupportedSchemeException
(
String
scheme
)
{
super
(
"Unsupported URI scheme: "
+
scheme
);
this
.
scheme
=
scheme
;
}
}
private
static
final
String
SCHEME_HTTP
=
"http"
;
private
static
final
String
SCHEME_HTTPS
=
"https"
;
private
static
final
String
SCHEME_FILE
=
"file"
;
private
static
final
String
SCHEME_ASSET
=
"asset"
;
private
static
final
String
SCHEME_CONTENT
=
"content"
;
...
...
@@ -141,9 +119,7 @@ public final class DefaultUriDataSource implements UriDataSource {
Assertions
.
checkState
(
dataSource
==
null
);
// Choose the correct source for the scheme.
String
scheme
=
dataSpec
.
uri
.
getScheme
();
if
(
SCHEME_HTTP
.
equals
(
scheme
)
||
SCHEME_HTTPS
.
equals
(
scheme
))
{
dataSource
=
httpDataSource
;
}
else
if
(
SCHEME_FILE
.
equals
(
scheme
)
||
TextUtils
.
isEmpty
(
scheme
))
{
if
(
SCHEME_FILE
.
equals
(
scheme
)
||
TextUtils
.
isEmpty
(
scheme
))
{
if
(
dataSpec
.
uri
.
getPath
().
startsWith
(
"/android_asset/"
))
{
dataSource
=
assetDataSource
;
}
else
{
...
...
@@ -154,7 +130,7 @@ public final class DefaultUriDataSource implements UriDataSource {
}
else
if
(
SCHEME_CONTENT
.
equals
(
scheme
))
{
dataSource
=
contentDataSource
;
}
else
{
throw
new
UnsupportedSchemeException
(
scheme
)
;
dataSource
=
httpDataSource
;
}
// Open the source and return.
return
dataSource
.
open
(
dataSpec
);
...
...
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