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
ce625215
authored
Oct 14, 2019
by
bachinger
Committed by
Oliver Woodman
Oct 15, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
disable download button for live content in demo app
PiperOrigin-RevId: 274585052
parent
c32ad60e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
6 deletions
demos/main/src/main/java/com/google/android/exoplayer2/demo/PlayerActivity.java
demos/main/src/main/java/com/google/android/exoplayer2/demo/Sample.java
demos/main/src/main/java/com/google/android/exoplayer2/demo/SampleChooserActivity.java
demos/main/src/main/res/values/strings.xml
demos/main/src/main/java/com/google/android/exoplayer2/demo/PlayerActivity.java
View file @
ce625215
...
...
@@ -107,6 +107,7 @@ public class PlayerActivity extends AppCompatActivity
public
static
final
String
URI_EXTRA
=
"uri"
;
public
static
final
String
EXTENSION_EXTRA
=
"extension"
;
public
static
final
String
IS_LIVE_EXTRA
=
"is_live"
;
public
static
final
String
DRM_SCHEME_EXTRA
=
"drm_scheme"
;
public
static
final
String
DRM_LICENSE_URL_EXTRA
=
"drm_license_url"
;
...
...
demos/main/src/main/java/com/google/android/exoplayer2/demo/Sample.java
View file @
ce625215
...
...
@@ -23,6 +23,7 @@ import static com.google.android.exoplayer2.demo.PlayerActivity.DRM_MULTI_SESSIO
import
static
com
.
google
.
android
.
exoplayer2
.
demo
.
PlayerActivity
.
DRM_SCHEME_EXTRA
;
import
static
com
.
google
.
android
.
exoplayer2
.
demo
.
PlayerActivity
.
DRM_SCHEME_UUID_EXTRA
;
import
static
com
.
google
.
android
.
exoplayer2
.
demo
.
PlayerActivity
.
EXTENSION_EXTRA
;
import
static
com
.
google
.
android
.
exoplayer2
.
demo
.
PlayerActivity
.
IS_LIVE_EXTRA
;
import
static
com
.
google
.
android
.
exoplayer2
.
demo
.
PlayerActivity
.
URI_EXTRA
;
import
android.content.Intent
;
...
...
@@ -40,32 +41,38 @@ import java.util.UUID;
public
static
UriSample
createFromIntent
(
Uri
uri
,
Intent
intent
,
String
extrasKeySuffix
)
{
String
extension
=
intent
.
getStringExtra
(
EXTENSION_EXTRA
+
extrasKeySuffix
);
String
adsTagUriString
=
intent
.
getStringExtra
(
AD_TAG_URI_EXTRA
+
extrasKeySuffix
);
boolean
isLive
=
intent
.
getBooleanExtra
(
IS_LIVE_EXTRA
+
extrasKeySuffix
,
/* defaultValue= */
false
);
Uri
adTagUri
=
adsTagUriString
!=
null
?
Uri
.
parse
(
adsTagUriString
)
:
null
;
return
new
UriSample
(
/* name= */
null
,
DrmInfo
.
createFromIntent
(
intent
,
extrasKeySuffix
),
uri
,
extension
,
isLive
,
DrmInfo
.
createFromIntent
(
intent
,
extrasKeySuffix
),
adTagUri
,
/* sphericalStereoMode= */
null
);
}
public
final
Uri
uri
;
public
final
String
extension
;
public
final
boolean
isLive
;
public
final
DrmInfo
drmInfo
;
public
final
Uri
adTagUri
;
public
final
String
sphericalStereoMode
;
@Nullable
public
final
String
sphericalStereoMode
;
public
UriSample
(
String
name
,
DrmInfo
drmInfo
,
Uri
uri
,
String
extension
,
boolean
isLive
,
DrmInfo
drmInfo
,
Uri
adTagUri
,
String
sphericalStereoMode
)
{
@Nullable
String
sphericalStereoMode
)
{
super
(
name
);
this
.
uri
=
uri
;
this
.
extension
=
extension
;
this
.
isLive
=
isLive
;
this
.
drmInfo
=
drmInfo
;
this
.
adTagUri
=
adTagUri
;
this
.
sphericalStereoMode
=
sphericalStereoMode
;
...
...
@@ -74,12 +81,14 @@ import java.util.UUID;
@Override
public
void
addToIntent
(
Intent
intent
)
{
intent
.
setAction
(
PlayerActivity
.
ACTION_VIEW
).
setData
(
uri
);
intent
.
putExtra
(
PlayerActivity
.
IS_LIVE_EXTRA
,
isLive
);
intent
.
putExtra
(
PlayerActivity
.
SPHERICAL_STEREO_MODE_EXTRA
,
sphericalStereoMode
);
addPlayerConfigToIntent
(
intent
,
/* extrasKeySuffix= */
""
);
}
public
void
addToPlaylistIntent
(
Intent
intent
,
String
extrasKeySuffix
)
{
intent
.
putExtra
(
PlayerActivity
.
URI_EXTRA
+
extrasKeySuffix
,
uri
.
toString
());
intent
.
putExtra
(
PlayerActivity
.
IS_LIVE_EXTRA
+
extrasKeySuffix
,
isLive
);
addPlayerConfigToIntent
(
intent
,
extrasKeySuffix
);
}
...
...
demos/main/src/main/java/com/google/android/exoplayer2/demo/SampleChooserActivity.java
View file @
ce625215
...
...
@@ -205,6 +205,9 @@ public class SampleChooserActivity extends AppCompatActivity
if
(
uriSample
.
drmInfo
!=
null
)
{
return
R
.
string
.
download_drm_unsupported
;
}
if
(
uriSample
.
isLive
)
{
return
R
.
string
.
download_live_unsupported
;
}
if
(
uriSample
.
adTagUri
!=
null
)
{
return
R
.
string
.
download_ads_unsupported
;
}
...
...
@@ -294,6 +297,7 @@ public class SampleChooserActivity extends AppCompatActivity
String
sampleName
=
null
;
Uri
uri
=
null
;
String
extension
=
null
;
boolean
isLive
=
false
;
String
drmScheme
=
null
;
String
drmLicenseUrl
=
null
;
String
[]
drmKeyRequestProperties
=
null
;
...
...
@@ -318,6 +322,9 @@ public class SampleChooserActivity extends AppCompatActivity
case
"drm_scheme"
:
drmScheme
=
reader
.
nextString
();
break
;
case
"is_live"
:
isLive
=
reader
.
nextBoolean
();
break
;
case
"drm_license_url"
:
drmLicenseUrl
=
reader
.
nextString
();
break
;
...
...
@@ -370,9 +377,10 @@ public class SampleChooserActivity extends AppCompatActivity
}
else
{
return
new
UriSample
(
sampleName
,
drmInfo
,
uri
,
extension
,
isLive
,
drmInfo
,
adTagUri
!=
null
?
Uri
.
parse
(
adTagUri
)
:
null
,
sphericalStereoMode
);
}
...
...
@@ -486,7 +494,7 @@ public class SampleChooserActivity extends AppCompatActivity
ImageButton
downloadButton
=
view
.
findViewById
(
R
.
id
.
download_button
);
downloadButton
.
setTag
(
sample
);
downloadButton
.
setColorFilter
(
canDownload
?
(
isDownloaded
?
0xFF42A5F5
:
0xFFBDBDBD
)
:
0xFF
EEEEEE
);
canDownload
?
(
isDownloaded
?
0xFF42A5F5
:
0xFFBDBDBD
)
:
0xFF
666666
);
downloadButton
.
setImageResource
(
isDownloaded
?
R
.
drawable
.
ic_download_done
:
R
.
drawable
.
ic_download
);
}
...
...
demos/main/src/main/res/values/strings.xml
View file @
ce625215
...
...
@@ -63,6 +63,8 @@
<string
name=
"download_scheme_unsupported"
>
This demo app only supports downloading http streams
</string>
<string
name=
"download_live_unsupported"
>
This demo app does not support downloading live content
</string>
<string
name=
"download_ads_unsupported"
>
IMA does not support offline ads
</string>
<string
name=
"prefer_extension_decoders"
>
Prefer extension decoders
</string>
...
...
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