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
0c159984
authored
Feb 05, 2019
by
andrewlewis
Committed by
Andrew Lewis
Feb 19, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Set player on ads loader in IMA demo
Issue: #5476 PiperOrigin-RevId: 232503736
parent
85b8e1f7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
11 deletions
demos/ima/src/main/java/com/google/android/exoplayer2/imademo/PlayerManager.java
demos/ima/src/main/java/com/google/android/exoplayer2/imademo/PlayerManager.java
View file @
0c159984
...
...
@@ -29,10 +29,6 @@ import com.google.android.exoplayer2.source.ads.AdsMediaSource;
import
com.google.android.exoplayer2.source.dash.DashMediaSource
;
import
com.google.android.exoplayer2.source.hls.HlsMediaSource
;
import
com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource
;
import
com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection
;
import
com.google.android.exoplayer2.trackselection.DefaultTrackSelector
;
import
com.google.android.exoplayer2.trackselection.TrackSelection
;
import
com.google.android.exoplayer2.trackselection.TrackSelector
;
import
com.google.android.exoplayer2.ui.PlayerView
;
import
com.google.android.exoplayer2.upstream.DataSource
;
import
com.google.android.exoplayer2.upstream.DefaultDataSourceFactory
;
...
...
@@ -56,14 +52,9 @@ import com.google.android.exoplayer2.util.Util;
}
public
void
init
(
Context
context
,
PlayerView
playerView
)
{
// Create a default track selector.
TrackSelection
.
Factory
videoTrackSelectionFactory
=
new
AdaptiveTrackSelection
.
Factory
();
TrackSelector
trackSelector
=
new
DefaultTrackSelector
(
videoTrackSelectionFactory
);
// Create a player instance.
player
=
ExoPlayerFactory
.
newSimpleInstance
(
context
,
trackSelector
);
// Bind the player to the view.
player
=
ExoPlayerFactory
.
newSimpleInstance
(
context
);
adsLoader
.
setPlayer
(
player
);
playerView
.
setPlayer
(
player
);
// This is the MediaSource representing the content media (i.e. not the ad).
...
...
@@ -89,6 +80,7 @@ import com.google.android.exoplayer2.util.Util;
contentPosition
=
player
.
getContentPosition
();
player
.
release
();
player
=
null
;
adsLoader
.
setPlayer
(
null
);
}
}
...
...
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