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
e6c7e296
authored
Nov 05, 2014
by
ojw28
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge pull request #121 from google/dev
dev -> dev-l
parents
38375670
712e4608
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
39 additions
and
7 deletions
demo/src/main/java/com/google/android/exoplayer/demo/DemoUtil.java
demo/src/main/java/com/google/android/exoplayer/demo/full/FullPlayerActivity.java
demo/src/main/java/com/google/android/exoplayer/demo/full/player/DashVodRendererBuilder.java
demo/src/main/java/com/google/android/exoplayer/demo/full/player/SmoothStreamingRendererBuilder.java
demo/src/main/java/com/google/android/exoplayer/demo/simple/DashVodRendererBuilder.java
demo/src/main/java/com/google/android/exoplayer/demo/simple/SimplePlayerActivity.java
demo/src/main/java/com/google/android/exoplayer/demo/simple/SmoothStreamingRendererBuilder.java
library/src/main/java/com/google/android/exoplayer/util/ManifestFetcher.java
demo/src/main/java/com/google/android/exoplayer/demo/DemoUtil.java
View file @
e6c7e296
...
@@ -28,6 +28,9 @@ import java.io.ByteArrayOutputStream;
...
@@ -28,6 +28,9 @@ import java.io.ByteArrayOutputStream;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.net.CookieHandler
;
import
java.net.CookieManager
;
import
java.net.CookiePolicy
;
import
java.net.HttpURLConnection
;
import
java.net.HttpURLConnection
;
import
java.net.MalformedURLException
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.net.URL
;
...
@@ -50,6 +53,13 @@ public class DemoUtil {
...
@@ -50,6 +53,13 @@ public class DemoUtil {
public
static
final
boolean
EXPOSE_EXPERIMENTAL_FEATURES
=
false
;
public
static
final
boolean
EXPOSE_EXPERIMENTAL_FEATURES
=
false
;
private
static
final
CookieManager
defaultCookieManager
;
static
{
defaultCookieManager
=
new
CookieManager
();
defaultCookieManager
.
setCookiePolicy
(
CookiePolicy
.
ACCEPT_ORIGINAL_SERVER
);
}
public
static
String
getUserAgent
(
Context
context
)
{
public
static
String
getUserAgent
(
Context
context
)
{
String
versionName
;
String
versionName
;
try
{
try
{
...
@@ -105,4 +115,11 @@ public class DemoUtil {
...
@@ -105,4 +115,11 @@ public class DemoUtil {
return
bytes
;
return
bytes
;
}
}
public
static
void
setDefaultCookieManager
()
{
CookieHandler
currentHandler
=
CookieHandler
.
getDefault
();
if
(
currentHandler
!=
defaultCookieManager
)
{
CookieHandler
.
setDefault
(
defaultCookieManager
);
}
}
}
}
demo/src/main/java/com/google/android/exoplayer/demo/full/FullPlayerActivity.java
View file @
e6c7e296
...
@@ -127,6 +127,8 @@ public class FullPlayerActivity extends Activity implements SurfaceHolder.Callba
...
@@ -127,6 +127,8 @@ public class FullPlayerActivity extends Activity implements SurfaceHolder.Callba
videoButton
=
(
Button
)
findViewById
(
R
.
id
.
video_controls
);
videoButton
=
(
Button
)
findViewById
(
R
.
id
.
video_controls
);
audioButton
=
(
Button
)
findViewById
(
R
.
id
.
audio_controls
);
audioButton
=
(
Button
)
findViewById
(
R
.
id
.
audio_controls
);
textButton
=
(
Button
)
findViewById
(
R
.
id
.
text_controls
);
textButton
=
(
Button
)
findViewById
(
R
.
id
.
text_controls
);
DemoUtil
.
setDefaultCookieManager
();
}
}
@Override
@Override
...
...
demo/src/main/java/com/google/android/exoplayer/demo/full/player/DashVodRendererBuilder.java
View file @
e6c7e296
...
@@ -97,7 +97,7 @@ public class DashVodRendererBuilder implements RendererBuilder,
...
@@ -97,7 +97,7 @@ public class DashVodRendererBuilder implements RendererBuilder,
this
.
callback
=
callback
;
this
.
callback
=
callback
;
MediaPresentationDescriptionParser
parser
=
new
MediaPresentationDescriptionParser
();
MediaPresentationDescriptionParser
parser
=
new
MediaPresentationDescriptionParser
();
ManifestFetcher
<
MediaPresentationDescription
>
manifestFetcher
=
ManifestFetcher
<
MediaPresentationDescription
>
manifestFetcher
=
new
ManifestFetcher
<
MediaPresentationDescription
>(
parser
,
contentId
,
url
);
new
ManifestFetcher
<
MediaPresentationDescription
>(
parser
,
contentId
,
url
,
userAgent
);
manifestFetcher
.
singleLoad
(
player
.
getMainHandler
().
getLooper
(),
this
);
manifestFetcher
.
singleLoad
(
player
.
getMainHandler
().
getLooper
(),
this
);
}
}
...
...
demo/src/main/java/com/google/android/exoplayer/demo/full/player/SmoothStreamingRendererBuilder.java
View file @
e6c7e296
...
@@ -92,7 +92,7 @@ public class SmoothStreamingRendererBuilder implements RendererBuilder,
...
@@ -92,7 +92,7 @@ public class SmoothStreamingRendererBuilder implements RendererBuilder,
this
.
callback
=
callback
;
this
.
callback
=
callback
;
SmoothStreamingManifestParser
parser
=
new
SmoothStreamingManifestParser
();
SmoothStreamingManifestParser
parser
=
new
SmoothStreamingManifestParser
();
manifestFetcher
=
new
ManifestFetcher
<
SmoothStreamingManifest
>(
parser
,
contentId
,
manifestFetcher
=
new
ManifestFetcher
<
SmoothStreamingManifest
>(
parser
,
contentId
,
url
+
"/Manifest"
);
url
+
"/Manifest"
,
userAgent
);
manifestFetcher
.
singleLoad
(
player
.
getMainHandler
().
getLooper
(),
this
);
manifestFetcher
.
singleLoad
(
player
.
getMainHandler
().
getLooper
(),
this
);
}
}
...
...
demo/src/main/java/com/google/android/exoplayer/demo/simple/DashVodRendererBuilder.java
View file @
e6c7e296
...
@@ -77,7 +77,7 @@ import java.util.ArrayList;
...
@@ -77,7 +77,7 @@ import java.util.ArrayList;
this
.
callback
=
callback
;
this
.
callback
=
callback
;
MediaPresentationDescriptionParser
parser
=
new
MediaPresentationDescriptionParser
();
MediaPresentationDescriptionParser
parser
=
new
MediaPresentationDescriptionParser
();
ManifestFetcher
<
MediaPresentationDescription
>
manifestFetcher
=
ManifestFetcher
<
MediaPresentationDescription
>
manifestFetcher
=
new
ManifestFetcher
<
MediaPresentationDescription
>(
parser
,
contentId
,
url
);
new
ManifestFetcher
<
MediaPresentationDescription
>(
parser
,
contentId
,
url
,
userAgent
);
manifestFetcher
.
singleLoad
(
playerActivity
.
getMainLooper
(),
this
);
manifestFetcher
.
singleLoad
(
playerActivity
.
getMainLooper
(),
this
);
}
}
...
...
demo/src/main/java/com/google/android/exoplayer/demo/simple/SimplePlayerActivity.java
View file @
e6c7e296
...
@@ -113,6 +113,8 @@ public class SimplePlayerActivity extends Activity implements SurfaceHolder.Call
...
@@ -113,6 +113,8 @@ public class SimplePlayerActivity extends Activity implements SurfaceHolder.Call
shutterView
=
findViewById
(
R
.
id
.
shutter
);
shutterView
=
findViewById
(
R
.
id
.
shutter
);
surfaceView
=
(
VideoSurfaceView
)
findViewById
(
R
.
id
.
surface_view
);
surfaceView
=
(
VideoSurfaceView
)
findViewById
(
R
.
id
.
surface_view
);
surfaceView
.
getHolder
().
addCallback
(
this
);
surfaceView
.
getHolder
().
addCallback
(
this
);
DemoUtil
.
setDefaultCookieManager
();
}
}
@Override
@Override
...
...
demo/src/main/java/com/google/android/exoplayer/demo/simple/SmoothStreamingRendererBuilder.java
View file @
e6c7e296
...
@@ -77,7 +77,7 @@ import java.util.ArrayList;
...
@@ -77,7 +77,7 @@ import java.util.ArrayList;
this
.
callback
=
callback
;
this
.
callback
=
callback
;
SmoothStreamingManifestParser
parser
=
new
SmoothStreamingManifestParser
();
SmoothStreamingManifestParser
parser
=
new
SmoothStreamingManifestParser
();
manifestFetcher
=
new
ManifestFetcher
<
SmoothStreamingManifest
>(
parser
,
contentId
,
manifestFetcher
=
new
ManifestFetcher
<
SmoothStreamingManifest
>(
parser
,
contentId
,
url
+
"/Manifest"
);
url
+
"/Manifest"
,
userAgent
);
manifestFetcher
.
singleLoad
(
playerActivity
.
getMainLooper
(),
this
);
manifestFetcher
.
singleLoad
(
playerActivity
.
getMainLooper
(),
this
);
}
}
...
...
library/src/main/java/com/google/android/exoplayer/util/ManifestFetcher.java
View file @
e6c7e296
...
@@ -63,6 +63,7 @@ public class ManifestFetcher<T> implements Loader.Callback {
...
@@ -63,6 +63,7 @@ public class ManifestFetcher<T> implements Loader.Callback {
/* package */
final
ManifestParser
<
T
>
parser
;
/* package */
final
ManifestParser
<
T
>
parser
;
/* package */
final
String
manifestUrl
;
/* package */
final
String
manifestUrl
;
/* package */
final
String
contentId
;
/* package */
final
String
contentId
;
/* package */
final
String
userAgent
;
private
int
enabledCount
;
private
int
enabledCount
;
private
Loader
loader
;
private
Loader
loader
;
...
@@ -79,11 +80,14 @@ public class ManifestFetcher<T> implements Loader.Callback {
...
@@ -79,11 +80,14 @@ public class ManifestFetcher<T> implements Loader.Callback {
* @param parser A parser to parse the loaded manifest data.
* @param parser A parser to parse the loaded manifest data.
* @param contentId The content id of the content being loaded. May be null.
* @param contentId The content id of the content being loaded. May be null.
* @param manifestUrl The manifest location.
* @param manifestUrl The manifest location.
* @param userAgent The User-Agent string that should be used.
*/
*/
public
ManifestFetcher
(
ManifestParser
<
T
>
parser
,
String
contentId
,
String
manifestUrl
)
{
public
ManifestFetcher
(
ManifestParser
<
T
>
parser
,
String
contentId
,
String
manifestUrl
,
String
userAgent
)
{
this
.
parser
=
parser
;
this
.
parser
=
parser
;
this
.
contentId
=
contentId
;
this
.
contentId
=
contentId
;
this
.
manifestUrl
=
manifestUrl
;
this
.
manifestUrl
=
manifestUrl
;
this
.
userAgent
=
userAgent
;
}
}
/**
/**
...
@@ -167,7 +171,7 @@ public class ManifestFetcher<T> implements Loader.Callback {
...
@@ -167,7 +171,7 @@ public class ManifestFetcher<T> implements Loader.Callback {
loader
=
new
Loader
(
"manifestLoader"
);
loader
=
new
Loader
(
"manifestLoader"
);
}
}
if
(!
loader
.
isLoading
())
{
if
(!
loader
.
isLoading
())
{
currentLoadable
=
new
ManifestLoadable
();
currentLoadable
=
new
ManifestLoadable
(
userAgent
);
loader
.
startLoading
(
currentLoadable
,
this
);
loader
.
startLoading
(
currentLoadable
,
this
);
}
}
}
}
...
@@ -217,7 +221,7 @@ public class ManifestFetcher<T> implements Loader.Callback {
...
@@ -217,7 +221,7 @@ public class ManifestFetcher<T> implements Loader.Callback {
this
.
callbackLooper
=
callbackLooper
;
this
.
callbackLooper
=
callbackLooper
;
this
.
wrappedCallback
=
wrappedCallback
;
this
.
wrappedCallback
=
wrappedCallback
;
singleUseLoader
=
new
Loader
(
"manifestLoader:single"
);
singleUseLoader
=
new
Loader
(
"manifestLoader:single"
);
singleUseLoadable
=
new
ManifestLoadable
();
singleUseLoadable
=
new
ManifestLoadable
(
userAgent
);
}
}
public
void
startLoading
()
{
public
void
startLoading
()
{
...
@@ -265,9 +269,15 @@ public class ManifestFetcher<T> implements Loader.Callback {
...
@@ -265,9 +269,15 @@ public class ManifestFetcher<T> implements Loader.Callback {
private
static
final
int
TIMEOUT_MILLIS
=
10000
;
private
static
final
int
TIMEOUT_MILLIS
=
10000
;
private
final
String
userAgent
;
/* package */
volatile
T
result
;
/* package */
volatile
T
result
;
private
volatile
boolean
isCanceled
;
private
volatile
boolean
isCanceled
;
public
ManifestLoadable
(
String
userAgent
)
{
this
.
userAgent
=
userAgent
;
}
@Override
@Override
public
void
cancelLoad
()
{
public
void
cancelLoad
()
{
// We don't actually cancel anything, but we need to record the cancellation so that
// We don't actually cancel anything, but we need to record the cancellation so that
...
@@ -302,6 +312,7 @@ public class ManifestFetcher<T> implements Loader.Callback {
...
@@ -302,6 +312,7 @@ public class ManifestFetcher<T> implements Loader.Callback {
connection
.
setConnectTimeout
(
TIMEOUT_MILLIS
);
connection
.
setConnectTimeout
(
TIMEOUT_MILLIS
);
connection
.
setReadTimeout
(
TIMEOUT_MILLIS
);
connection
.
setReadTimeout
(
TIMEOUT_MILLIS
);
connection
.
setDoOutput
(
false
);
connection
.
setDoOutput
(
false
);
connection
.
setRequestProperty
(
"User-Agent"
,
userAgent
);
connection
.
connect
();
connection
.
connect
();
return
connection
;
return
connection
;
}
}
...
...
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