Skip to content

Commit 13885d5

Browse files
committed
Update exoplayer to 2.9.6
refs #9
1 parent 200556f commit 13885d5

File tree

7 files changed

+162
-164
lines changed

7 files changed

+162
-164
lines changed

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def exoPlayerVersion = '2.8.4'
1+
def exoPlayerVersion = '2.9.6'
22

33
repositories {
44
google()

android/src/ru/netris/mobile/exoplayer/DownloadTracker.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import com.google.android.exoplayer2.offline.DownloadManager.TaskState;
3737
import com.google.android.exoplayer2.offline.DownloadService;
3838
import com.google.android.exoplayer2.offline.ProgressiveDownloadHelper;
39-
import com.google.android.exoplayer2.offline.SegmentDownloadAction;
39+
import com.google.android.exoplayer2.offline.StreamKey;
4040
import com.google.android.exoplayer2.offline.TrackKey;
4141
import com.google.android.exoplayer2.source.TrackGroup;
4242
import com.google.android.exoplayer2.source.TrackGroupArray;
@@ -116,16 +116,12 @@ public boolean isDownloaded(Uri uri)
116116
}
117117

118118
@SuppressWarnings("unchecked")
119-
public <K> List<K> getOfflineStreamKeys(Uri uri)
119+
public List<StreamKey> getOfflineStreamKeys(Uri uri)
120120
{
121121
if (!trackedDownloadStates.containsKey(uri)) {
122122
return Collections.emptyList();
123123
}
124-
DownloadAction action = trackedDownloadStates.get(uri);
125-
if (action instanceof SegmentDownloadAction) {
126-
return ((SegmentDownloadAction) action).keys;
127-
}
128-
return Collections.emptyList();
124+
return trackedDownloadStates.get(uri).getKeys();
129125
}
130126

131127
public void toggleDownload(Activity activity, String name, Uri uri, String extension)

android/src/ru/netris/mobile/exoplayer/DownloadTrackerProxy.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ public DownloadTrackerProxy()
5555
}
5656

5757
/** Returns a {@link HttpDataSource.Factory}. */
58-
public HttpDataSource.Factory buildHttpDataSourceFactory(TransferListener<? super DataSource> listener)
58+
public HttpDataSource.Factory buildHttpDataSourceFactory()
5959
{
60-
return new DefaultHttpDataSourceFactory(userAgent, listener);
60+
return new DefaultHttpDataSourceFactory(userAgent);
6161
}
6262

6363
/** Returns a {@link DataSource.Factory}. */
64-
public DataSource.Factory buildDataSourceFactory(TransferListener<? super DataSource> listener)
64+
public DataSource.Factory buildDataSourceFactory()
6565
{
66-
DefaultDataSourceFactory upstreamFactory = new DefaultDataSourceFactory(
67-
TiApplication.getAppRootOrCurrentActivity(), listener, buildHttpDataSourceFactory(listener));
66+
DefaultDataSourceFactory upstreamFactory =
67+
new DefaultDataSourceFactory(TiApplication.getAppRootOrCurrentActivity(), buildHttpDataSourceFactory());
6868
return buildReadOnlyCacheDataSource(upstreamFactory, getDownloadCache());
6969
}
7070

@@ -84,12 +84,12 @@ private synchronized void initDownloadManager()
8484
{
8585
if (downloadManager == null) {
8686
DownloaderConstructorHelper downloaderConstructorHelper =
87-
new DownloaderConstructorHelper(getDownloadCache(), buildHttpDataSourceFactory(/* listener= */ null));
87+
new DownloaderConstructorHelper(getDownloadCache(), buildHttpDataSourceFactory());
8888
downloadManager = new DownloadManager(
8989
downloaderConstructorHelper, maxSimultaneousDownloads, DownloadManager.DEFAULT_MIN_RETRY_COUNT,
9090
new File(getDownloadDirectory(), downloadActionFile), DOWNLOAD_DESERIALIZERS);
9191
downloadTracker = new DownloadTracker(
92-
/* context= */ TiApplication.getInstance(), buildDataSourceFactory(/* listener= */ null),
92+
/* context= */ TiApplication.getInstance(), buildDataSourceFactory(),
9393
new File(getDownloadDirectory(), downloadTrackerActionFile), DOWNLOAD_DESERIALIZERS);
9494
downloadManager.addListener(downloadTracker);
9595
downloadTracker.addListener(this);

android/src/ru/netris/mobile/exoplayer/TiUIVideoView.java

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
import com.google.android.exoplayer2.metadata.Metadata;
6464
import com.google.android.exoplayer2.metadata.MetadataOutput;
6565
import com.google.android.exoplayer2.offline.FilteringManifestParser;
66+
import com.google.android.exoplayer2.offline.StreamKey;
6667
import com.google.android.exoplayer2.source.BehindLiveWindowException;
6768
import com.google.android.exoplayer2.source.ExtractorMediaSource;
6869
import com.google.android.exoplayer2.source.MediaSource;
@@ -72,14 +73,12 @@
7273
import com.google.android.exoplayer2.source.dash.DashMediaSource;
7374
import com.google.android.exoplayer2.source.dash.DefaultDashChunkSource;
7475
import com.google.android.exoplayer2.source.dash.manifest.DashManifestParser;
75-
import com.google.android.exoplayer2.source.dash.manifest.RepresentationKey;
7676
import com.google.android.exoplayer2.source.hls.HlsMediaSource;
77+
import com.google.android.exoplayer2.source.hls.playlist.DefaultHlsPlaylistParserFactory;
7778
import com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistParser;
78-
import com.google.android.exoplayer2.source.hls.playlist.RenditionKey;
7979
import com.google.android.exoplayer2.source.smoothstreaming.DefaultSsChunkSource;
8080
import com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource;
8181
import com.google.android.exoplayer2.source.smoothstreaming.manifest.SsManifestParser;
82-
import com.google.android.exoplayer2.source.smoothstreaming.manifest.StreamKey;
8382
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
8483
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
8584
import com.google.android.exoplayer2.trackselection.FixedTrackSelection;
@@ -689,10 +688,8 @@ public void initializePlayer()
689688
TiConvert.toString(proxy.getProperty(TiExoplayerModule.PROPERTY_DRM_LICENSE_URL));
690689
String[] keyRequestPropertiesArray = TiConvert.toStringArray(
691690
(Object[]) proxy.getProperty(TiExoplayerModule.PROPERTY_DRM_KEY_REQUEST_PROPERTIES));
692-
//Deprecated "drm_multi_session"
693691
boolean multiSession =
694-
TiConvert.toBoolean(proxy.getProperty(TiExoplayerModule.PROPERTY_DRM_MULTI_SESSION_EXTRA),
695-
TiConvert.toBoolean(proxy.getProperty("drm_multi_session"), false));
692+
TiConvert.toBoolean(proxy.getProperty(TiExoplayerModule.PROPERTY_DRM_MULTI_SESSION_EXTRA), false);
696693
try {
697694
int errorStringId = TiRHelper.getResource("string.error_drm_unknown");
698695
if (Util.SDK_INT < 18) {
@@ -729,7 +726,8 @@ public void initializePlayer()
729726
DefaultRenderersFactory renderersFactory =
730727
new DefaultRenderersFactory(activity, drmSessionManager, extensionRendererMode);
731728

732-
player = ExoPlayerFactory.newSimpleInstance(renderersFactory, trackSelector, drmSessionManager);
729+
player = ExoPlayerFactory.newSimpleInstance(proxy.getActivity(), renderersFactory, trackSelector,
730+
drmSessionManager);
733731
player.addListener(this);
734732
player.addMetadataOutput(this);
735733
player.setVideoDebugListener(this);
@@ -868,7 +866,7 @@ public void updateResumePosition()
868866
}
869867
}
870868

871-
private List<?> getOfflineStreamKeys(Uri uri)
869+
private List<StreamKey> getOfflineStreamKeys(Uri uri)
872870
{
873871
return TiExoplayerModule.getInstance().getDownloadTrackerProxy().getDownloadTracker().getOfflineStreamKeys(uri);
874872
}
@@ -914,19 +912,17 @@ private MediaSource buildMediaSource(Uri uri, @ContentType int type)
914912
case C.TYPE_DASH:
915913
return new DashMediaSource
916914
.Factory(new DefaultDashChunkSource.Factory(mediaDataSourceFactory), buildDataSourceFactory(false))
917-
.setManifestParser(new FilteringManifestParser<>(
918-
new DashManifestParser(), (List<RepresentationKey>) getOfflineStreamKeys(uri)))
915+
.setManifestParser(
916+
new FilteringManifestParser<>(new DashManifestParser(), getOfflineStreamKeys(uri)))
919917
.createMediaSource(uri);
920918
case C.TYPE_SS:
921919
return new SsMediaSource
922920
.Factory(new DefaultSsChunkSource.Factory(mediaDataSourceFactory), buildDataSourceFactory(false))
923-
.setManifestParser(new FilteringManifestParser<>(new SsManifestParser(),
924-
(List<StreamKey>) getOfflineStreamKeys(uri)))
921+
.setManifestParser(new FilteringManifestParser<>(new SsManifestParser(), getOfflineStreamKeys(uri)))
925922
.createMediaSource(uri);
926923
case C.TYPE_HLS:
927924
return new HlsMediaSource.Factory(mediaDataSourceFactory)
928-
.setPlaylistParser(new FilteringManifestParser<>(new HlsPlaylistParser(),
929-
(List<RenditionKey>) getOfflineStreamKeys(uri)))
925+
.setPlaylistParserFactory(new DefaultHlsPlaylistParserFactory(getOfflineStreamKeys(uri)))
930926
.createMediaSource(uri);
931927
case C.TYPE_OTHER:
932928
return new ExtractorMediaSource.Factory(mediaDataSourceFactory).createMediaSource(uri);
@@ -977,7 +973,7 @@ public int[] getSupportedTypes()
977973
return new int[] { C.TYPE_DASH, C.TYPE_SS, C.TYPE_HLS, C.TYPE_OTHER };
978974
}
979975
};
980-
return new AdsMediaSource(mediaSource, adMediaSourceFactory, adsLoader, adUiViewGroup);
976+
return new AdsMediaSource(mediaSource, adMediaSourceFactory, adsLoader, videoView);
981977
}
982978

983979
/**
@@ -989,8 +985,7 @@ public int[] getSupportedTypes()
989985
*/
990986
private DataSource.Factory buildDataSourceFactory(boolean useBandwidthMeter)
991987
{
992-
return TiExoplayerModule.getInstance().getDownloadTrackerProxy().buildDataSourceFactory(
993-
useBandwidthMeter ? BANDWIDTH_METER : null);
988+
return TiExoplayerModule.getInstance().getDownloadTrackerProxy().buildDataSourceFactory();
994989
}
995990

996991
private static String getDiscontinuityReasonString(@Player.DiscontinuityReason int reason)

android/src/ru/netris/mobile/exoplayer/VideoPlayerProxy.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,6 @@ public void onTracksChanged(KrollDict tracks)
733733
{
734734
KrollDict data = new KrollDict();
735735
data.put("trackInfo", tracks);
736-
fireEvent("tracksChanged", data); //Deprecated
737736
fireEvent(TiExoplayerModule.EVENT_TRACKS_CHANGED, data);
738737
}
739738

documentation/index.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ For full VideoPlayer API see documentation for original [Ti.Media.VideoPlayer](h
7272
* `naturalsizeavailable`: new event, property `naturalSize`
7373
(see [VideoRendererEventListener.onVideoSizeChanged](http://google.github.io/ExoPlayer/doc/reference/com/google/android/exoplayer2/video/VideoRendererEventListener.html#onVideoSizeChanged-int-int-int-float-)).
7474
Fired before a frame is rendered for the first time since setting the surface, and each time there's a change in the size, rotation or pixel aspect ratio of the video being rendered.
75-
* **Deprecated** (use `trackschange`) `tracksChanged`: new event, property `trackInfo`
7675
* `trackschange`: new event, property `trackInfo`
7776
* `volumechange`: new event, property `volume`. Fired when the volume on [`AudioManager.STREAM_MUSIC`](https://developer.android.com/reference/android/media/AudioManager.html#STREAM_MUSIC) changes.
7877

@@ -81,7 +80,6 @@ For full VideoPlayer API see documentation for original [Ti.Media.VideoPlayer](h
8180
* `contentExtension`: type `string`, when defined content type will be detected based on this property
8281
* `contentType`: one of `ExoPlayer.CONTENT_TYPE_*`
8382
* `drmLicenseUrl`
84-
* **Deprecated** (use `drmMultiSession`) `drm_multi_session`: type `boolean`, specify whether multiple key session support is enabled. Default value `false`
8583
* `drmMultiSession`: type `boolean`, specify whether multiple key session support is enabled. Default value `false`
8684
* `drmScheme`: one of `ExoPlayer.DRM_*`
8785
* `drmKeyRequestProperties`

0 commit comments

Comments
 (0)