diff --git a/README.md b/README.md index 48c37f82..337d0c6c 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,9 @@ back to the MediaPlayer. This is useful for supporting Http Live Streaming (HLS) and full HD (1080p +) playback since the Android VideoView struggles with those. +**NOTE:** HLS, DASH, and other streaming protocols are not supported on Android 4.0.* and below +due to constraints with the Android MediaPlayer and VideoView + Website And Documentation ------- diff --git a/demo/src/main/java/com/devbrackets/android/exomediademo/ui/activity/VideoPlayerActivity.java b/demo/src/main/java/com/devbrackets/android/exomediademo/ui/activity/VideoPlayerActivity.java index 4c511612..1e66a9f2 100644 --- a/demo/src/main/java/com/devbrackets/android/exomediademo/ui/activity/VideoPlayerActivity.java +++ b/demo/src/main/java/com/devbrackets/android/exomediademo/ui/activity/VideoPlayerActivity.java @@ -23,6 +23,7 @@ protected void onCreate(Bundle savedInstanceState) { //For now we just picked an arbitrary item to play. More can be found at //https://archive.org/details/more_animation emVideoView.setVideoURI(Uri.parse("https://archive.org/download/Popeye_forPresident/Popeye_forPresident_512kb.mp4")); +// emVideoView.setVideoURI(Uri.parse("http://cdn-fms.rbs.com.br/vod/hls_sample1_manifest.m3u8")); } @Override diff --git a/library/build.gradle b/library/build.gradle index 284a55f8..6481cf2d 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -15,7 +15,7 @@ dependencies { compile 'com.android.support:appcompat-v7:23.0.1' // includes support-v4 // ExoPlayer - compile 'com.google.android.exoplayer:exoplayer:r1.4.2' + compile 'com.google.android.exoplayer:exoplayer:r1.5.0' } android { diff --git a/library/src/main/java/com/devbrackets/android/exomedia/EMAudioPlayer.java b/library/src/main/java/com/devbrackets/android/exomedia/EMAudioPlayer.java index b8709df1..bc156950 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/EMAudioPlayer.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/EMAudioPlayer.java @@ -222,7 +222,7 @@ public void stopProgressPoll() { private RenderBuilder getRendererBuilder(AudioType renderType, Uri uri, MediaUtil.MediaType defaultMediaType) { switch (renderType) { case HLS: - return new HlsRenderBuilder(context, getUserAgent(), uri.toString(), audioCapabilities); + return new HlsRenderBuilder(context, getUserAgent(), uri.toString()); default: return new RenderBuilder(context, getUserAgent(), uri.toString(), defaultMediaType); } diff --git a/library/src/main/java/com/devbrackets/android/exomedia/EMListenerMux.java b/library/src/main/java/com/devbrackets/android/exomedia/EMListenerMux.java index 590a9d5c..853867d5 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/EMListenerMux.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/EMListenerMux.java @@ -150,11 +150,11 @@ public void onStateChanged(boolean playWhenReady, int playbackState) { } @Override - public void onVideoSizeChanged(int width, int height, float pixelWidthHeightRatio) { + public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) { muxNotifier.onVideoSizeChanged(width, height, pixelWidthHeightRatio); for (ExoPlayerListener listener : exoPlayerListeners) { - listener.onVideoSizeChanged(width, height, pixelWidthHeightRatio); + listener.onVideoSizeChanged(width, height, unappliedRotationDegrees, pixelWidthHeightRatio); } } diff --git a/library/src/main/java/com/devbrackets/android/exomedia/EMVideoView.java b/library/src/main/java/com/devbrackets/android/exomedia/EMVideoView.java index 9cbb9104..56e65ead 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/EMVideoView.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/EMVideoView.java @@ -243,7 +243,7 @@ private void setupVideoView() { private RenderBuilder getRendererBuilder(VideoType renderType, Uri uri, MediaUtil.MediaType defaultMediaType) { switch (renderType) { case HLS: - return new HlsRenderBuilder(getContext(), getUserAgent(), uri.toString(), audioCapabilities); + return new HlsRenderBuilder(getContext(), getUserAgent(), uri.toString()); default: return new RenderBuilder(getContext(), getUserAgent(), uri.toString(), defaultMediaType); } diff --git a/library/src/main/java/com/devbrackets/android/exomedia/builder/HlsRenderBuilder.java b/library/src/main/java/com/devbrackets/android/exomedia/builder/HlsRenderBuilder.java index 841539d6..c22c4999 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/builder/HlsRenderBuilder.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/builder/HlsRenderBuilder.java @@ -22,14 +22,12 @@ import android.os.Build; import com.devbrackets.android.exomedia.exoplayer.EMExoPlayer; -import com.devbrackets.android.exomedia.listener.RendererBuilderCallback; import com.google.android.exoplayer.DefaultLoadControl; import com.google.android.exoplayer.LoadControl; import com.google.android.exoplayer.MediaCodecAudioTrackRenderer; import com.google.android.exoplayer.MediaCodecUtil; import com.google.android.exoplayer.MediaCodecVideoTrackRenderer; import com.google.android.exoplayer.TrackRenderer; -import com.google.android.exoplayer.audio.AudioCapabilities; import com.google.android.exoplayer.chunk.VideoFormatSelectorUtil; import com.google.android.exoplayer.hls.HlsChunkSource; import com.google.android.exoplayer.hls.HlsMasterPlaylist; @@ -54,23 +52,19 @@ */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN) public class HlsRenderBuilder extends RenderBuilder implements ManifestCallback { - private final AudioCapabilities audioCapabilities; private static final int BUFFER_SEGMENT_SIZE = 256 * 1024; private static final int BUFFER_SEGMENTS = 64; private EMExoPlayer player; - private RendererBuilderCallback callback; - public HlsRenderBuilder(Context context, String userAgent, String url, AudioCapabilities audioCapabilities) { + public HlsRenderBuilder(Context context, String userAgent, String url) { super(context, userAgent, url); - this.audioCapabilities = audioCapabilities; } @Override - public void buildRenderers(EMExoPlayer player, RendererBuilderCallback callback) { + public void buildRenderers(EMExoPlayer player) { this.player = player; - this.callback = callback; HlsPlaylistParser parser = new HlsPlaylistParser(); ManifestFetcher playlistFetcher = new ManifestFetcher<>(uri, new DefaultUriDataSource(context, null, userAgent, true), parser); playlistFetcher.singleLoad(player.getMainHandler().getLooper(), this); @@ -78,7 +72,7 @@ public void buildRenderers(EMExoPlayer player, RendererBuilderCallback callback) @Override public void onSingleManifestError(IOException e) { - callback.onRenderersError(e); + player.onRenderersError(e); } @Override @@ -94,7 +88,7 @@ public void onSingleManifest(HlsPlaylist playlist) { try { variantIndices = VideoFormatSelectorUtil.selectVideoFormatsForDefaultDisplay(context, masterPlaylist.variants, null, false); } catch (MediaCodecUtil.DecoderQueryException e) { - callback.onRenderersError(e); + player.onRenderersError(e); return; } } @@ -102,7 +96,7 @@ public void onSingleManifest(HlsPlaylist playlist) { //Create the Sample Source to be used by the renders DataSource dataSource = new DefaultUriDataSource(context, bandwidthMeter, userAgent, true); HlsChunkSource chunkSource = new HlsChunkSource(dataSource, uri, playlist, bandwidthMeter, - variantIndices, HlsChunkSource.ADAPTIVE_MODE_SPLICE, audioCapabilities); + variantIndices, HlsChunkSource.ADAPTIVE_MODE_SPLICE); HlsSampleSource sampleSource = new HlsSampleSource(chunkSource, loadControl, BUFFER_SEGMENTS * BUFFER_SEGMENT_SIZE, player.getMainHandler(), player, EMExoPlayer.RENDER_VIDEO_INDEX); @@ -122,7 +116,7 @@ public void onSingleManifest(HlsPlaylist playlist) { renderers[EMExoPlayer.RENDER_VIDEO_INDEX] = videoRenderer; renderers[EMExoPlayer.RENDER_AUDIO_INDEX] = audioRenderer; renderers[EMExoPlayer.RENDER_TIMED_METADATA_INDEX] = id3Renderer; - callback.onRenderers(null, null, renderers, bandwidthMeter); + player.onRenderers(renderers, bandwidthMeter); } } \ No newline at end of file diff --git a/library/src/main/java/com/devbrackets/android/exomedia/builder/RenderBuilder.java b/library/src/main/java/com/devbrackets/android/exomedia/builder/RenderBuilder.java index 070cacea..44690aba 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/builder/RenderBuilder.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/builder/RenderBuilder.java @@ -24,7 +24,6 @@ import android.util.Log; import com.devbrackets.android.exomedia.exoplayer.EMExoPlayer; -import com.devbrackets.android.exomedia.listener.RendererBuilderCallback; import com.devbrackets.android.exomedia.renderer.EMMediaCodecAudioTrackRenderer; import com.devbrackets.android.exomedia.util.MediaUtil; import com.google.android.exoplayer.MediaCodecVideoTrackRenderer; @@ -72,7 +71,7 @@ public RenderBuilder(Context context, String userAgent, String uri, MediaUtil.Me this.requestedDefaultType = defaultType; } - public void buildRenderers(EMExoPlayer player, RendererBuilderCallback callback) { + public void buildRenderers(EMExoPlayer player) { //Create the Sample Source to be used by the renderers Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE); DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(player.getMainHandler(), player); @@ -92,7 +91,11 @@ public void buildRenderers(EMExoPlayer player, RendererBuilderCallback callback) TrackRenderer[] renderers = new TrackRenderer[EMExoPlayer.RENDER_COUNT]; renderers[EMExoPlayer.RENDER_VIDEO_INDEX] = videoRenderer; renderers[EMExoPlayer.RENDER_AUDIO_INDEX] = audioRenderer; - callback.onRenderers(null, null, renderers, bandwidthMeter); + player.onRenderers(renderers, bandwidthMeter); + } + + public void cancel() { + //Purposefully left blank } /** @@ -155,7 +158,7 @@ protected Extractor getExtractor(MediaUtil.MediaType mediaType, MediaUtil.MediaT return new Mp3Extractor(); case TS: - return new TsExtractor(0, null); + return new TsExtractor(); case WEBM: case MKV: diff --git a/library/src/main/java/com/devbrackets/android/exomedia/exoplayer/EMExoPlayer.java b/library/src/main/java/com/devbrackets/android/exomedia/exoplayer/EMExoPlayer.java index 14d788e3..696e78b4 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/exoplayer/EMExoPlayer.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/exoplayer/EMExoPlayer.java @@ -31,7 +31,6 @@ import com.devbrackets.android.exomedia.listener.Id3MetadataListener; import com.devbrackets.android.exomedia.listener.InfoListener; import com.devbrackets.android.exomedia.listener.InternalErrorListener; -import com.devbrackets.android.exomedia.listener.RendererBuilderCallback; import com.devbrackets.android.exomedia.listener.CaptionListener; import com.devbrackets.android.exomedia.renderer.EMMediaCodecAudioTrackRenderer; import com.google.android.exoplayer.DummyTrackRenderer; @@ -45,7 +44,6 @@ import com.google.android.exoplayer.audio.AudioTrack; import com.google.android.exoplayer.chunk.ChunkSampleSource; import com.google.android.exoplayer.chunk.Format; -import com.google.android.exoplayer.chunk.MultiTrackChunkSource; import com.google.android.exoplayer.dash.DashChunkSource; import com.google.android.exoplayer.drm.StreamingDrmSessionManager; import com.google.android.exoplayer.hls.HlsSampleSource; @@ -75,7 +73,6 @@ public class EMExoPlayer implements TextRenderer { public static final int DISABLED_TRACK = -1; - public static final int PRIMARY_TRACK = 0; public static final int RENDER_COUNT = 4; public static final int RENDER_VIDEO_INDEX = 0; @@ -105,14 +102,9 @@ public enum RenderBuildingState { private boolean prepared = false; private Surface surface; - private InternalRendererBuilderCallback builderCallback; private TrackRenderer videoRenderer; private TrackRenderer audioRenderer; - private MultiTrackChunkSource[] multiTrackSources; - private String[][] trackNames; - private int[] selectedTracks; - private CaptionListener captionListener; private Id3MetadataListener id3MetadataListener; private InternalErrorListener internalErrorListener; @@ -129,14 +121,12 @@ public EMExoPlayer(RenderBuilder rendererBuilder) { player = ExoPlayer.Factory.newInstance(RENDER_COUNT, BUFFER_LENGTH_MIN, REBUFFER_LENGTH_MIN); player.addListener(this); playerControl = new PlayerControl(player); + mainHandler = new Handler(); listeners = new CopyOnWriteArrayList<>(); lastReportedPlaybackState = ExoPlayer.STATE_IDLE; rendererBuildingState = RenderBuildingState.IDLE; - selectedTracks = new int[RENDER_COUNT]; - - // Disable closed captions initially - selectedTracks[RENDER_CLOSED_CAPTION_INDEX] = DISABLED_TRACK; + player.setSelectedTrack(RENDER_CLOSED_CAPTION_INDEX, DISABLED_TRACK); } public void replaceRenderBuilder(RenderBuilder renderBuilder) { @@ -193,24 +183,15 @@ public void blockingClearSurface() { } public int getTrackCount(int type) { - return !player.getRendererHasMedia(type) ? 0 : trackNames[type].length; - } - - public String getTrackName(int type, int index) { - return trackNames[type][index]; + return player.getTrackCount(type); } - public int getSelectedTrackIndex(int type) { - return selectedTracks[type]; + public int getSelectedTrack(int type) { + return player.getSelectedTrack(type); } - public void selectTrack(int type, int index) { - if (selectedTracks[type] == index) { - return; - } - - selectedTracks[type] = index; - pushTrackSelection(type, true); + public void setSelectedTrack(int type, int index) { + player.setSelectedTrack(type, index); if (type == RENDER_CLOSED_CAPTION_INDEX && index == DISABLED_TRACK && captionListener != null) { captionListener.onCues(Collections.emptyList()); } @@ -233,62 +214,32 @@ public void prepare() { player.stop(); } - if (builderCallback != null) { - builderCallback.cancel(); - } - videoRenderer = null; - multiTrackSources = null; - rendererBuildingState = RenderBuildingState.BUILDING; reportPlayerState(); - builderCallback = new InternalRendererBuilderCallback(); - rendererBuilder.buildRenderers(this, builderCallback); + rendererBuilder.buildRenderers(this); prepared = true; } - public void onRenderers(String[][] trackNames, MultiTrackChunkSource[] multiTrackSources, TrackRenderer[] renderers, @Nullable BandwidthMeter bandwidthMeter) { - builderCallback = null; - - // Normalize the results. - if (trackNames == null) { - trackNames = new String[RENDER_COUNT][]; - } - - if (multiTrackSources == null) { - multiTrackSources = new MultiTrackChunkSource[RENDER_COUNT]; - } - + public void onRenderers(TrackRenderer[] renderers, @Nullable BandwidthMeter bandwidthMeter) { for (int i = 0; i < RENDER_COUNT; i++) { if (renderers[i] == null) { // Convert a null renderer to a dummy renderer. renderers[i] = new DummyTrackRenderer(); - } else if (trackNames[i] == null) { - // We have a renderer so we must have at least one track, but the names are unknown. - // Initialize the correct number of null track names. - int trackCount = multiTrackSources[i] == null ? 1 : multiTrackSources[i].getTrackCount(); - trackNames[i] = new String[trackCount]; } } // Complete preparation. - this.trackNames = trackNames; this.videoRenderer = renderers[RENDER_VIDEO_INDEX]; this.audioRenderer = renderers[RENDER_AUDIO_INDEX]; - this.multiTrackSources = multiTrackSources; pushSurface(false); - pushTrackSelection(RENDER_VIDEO_INDEX, true); - pushTrackSelection(RENDER_AUDIO_INDEX, true); - pushTrackSelection(RENDER_CLOSED_CAPTION_INDEX, true); player.prepare(renderers); rendererBuildingState = RenderBuildingState.BUILT; } public void onRenderersError(Exception e) { - builderCallback = null; - if (internalErrorListener != null) { internalErrorListener.onRendererInitializationError(e); } @@ -310,9 +261,8 @@ public void seekTo(long positionMs) { } public void release() { - if (builderCallback != null) { - builderCallback.cancel(); - builderCallback = null; + if (rendererBuilder != null) { + rendererBuilder.cancel(); } rendererBuildingState = RenderBuildingState.IDLE; @@ -320,7 +270,6 @@ public void release() { player.release(); } - public int getPlaybackState() { if (rendererBuildingState == RenderBuildingState.BUILDING) { return ExoPlayer.STATE_PREPARING; @@ -405,9 +354,9 @@ public void onPlayerError(ExoPlaybackException exception) { } @Override - public void onVideoSizeChanged(int width, int height, float pixelWidthHeightRatio) { + public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) { for (ExoPlayerListener listener : listeners) { - listener.onVideoSizeChanged(width, height, pixelWidthHeightRatio); + listener.onVideoSizeChanged(width, height, unappliedRotationDegrees, pixelWidthHeightRatio); } } @@ -426,7 +375,7 @@ public void onBandwidthSample(int elapsedMs, long bytes, long bitrateEstimate) { } @Override - public void onDownstreamFormatChanged(int sourceId, Format format, int trigger, int mediaTimeMs) { + public void onDownstreamFormatChanged(int sourceId, Format format, int trigger, long mediaTimeMs) { if (infoListener == null) { return; } @@ -438,6 +387,11 @@ public void onDownstreamFormatChanged(int sourceId, Format format, int trigger, } } + @Override + public void onDrmKeysLoaded() { + //Purposefully left blank + } + @Override public void onDrmSessionManagerError(Exception e) { if (internalErrorListener != null) { @@ -489,22 +443,22 @@ public void onLoadError(int sourceId, IOException e) { @Override public void onCues(List cues) { - if (captionListener != null && selectedTracks[RENDER_CLOSED_CAPTION_INDEX] != DISABLED_TRACK) { + if (captionListener != null && getSelectedTrack(RENDER_CLOSED_CAPTION_INDEX) != DISABLED_TRACK) { captionListener.onCues(cues); } } @Override public void onMetadata(Map metadata) { - if (id3MetadataListener != null && selectedTracks[RENDER_TIMED_METADATA_INDEX] != DISABLED_TRACK) { + if (id3MetadataListener != null && getSelectedTrack(RENDER_TIMED_METADATA_INDEX) != DISABLED_TRACK) { id3MetadataListener.onId3Metadata(metadata); } } @Override - public void onSeekRangeChanged(TimeRange seekRange) { + public void onAvailableRangeChanged(TimeRange availableRange) { if (infoListener != null) { - infoListener.onSeekRangeChanged(seekRange); + infoListener.onAvailableRangeChanged(availableRange); } } @@ -519,14 +473,14 @@ public void onDrawnToSurface(Surface surface) { } @Override - public void onLoadStarted(int sourceId, long length, int type, int trigger, Format format, int mediaStartTimeMs, int mediaEndTimeMs) { + public void onLoadStarted(int sourceId, long length, int type, int trigger, Format format, long mediaStartTimeMs, long mediaEndTimeMs) { if (infoListener != null) { infoListener.onLoadStarted(sourceId, length, type, trigger, format, mediaStartTimeMs, mediaEndTimeMs); } } @Override - public void onLoadCompleted(int sourceId, long bytesLoaded, int type, int trigger, Format format, int mediaStartTimeMs, int mediaEndTimeMs, long elapsedRealtimeMs, long loadDurationMs) { + public void onLoadCompleted(int sourceId, long bytesLoaded, int type, int trigger, Format format, long mediaStartTimeMs, long mediaEndTimeMs, long elapsedRealtimeMs, long loadDurationMs) { if (infoListener != null) { infoListener.onLoadCompleted(sourceId, bytesLoaded, type, trigger, format, mediaStartTimeMs, mediaEndTimeMs, elapsedRealtimeMs, loadDurationMs); } @@ -538,7 +492,7 @@ public void onLoadCanceled(int sourceId, long bytesLoaded) { } @Override - public void onUpstreamDiscarded(int sourceId, int mediaStartTimeMs, int mediaEndTimeMs) { + public void onUpstreamDiscarded(int sourceId, long mediaStartTimeMs, long mediaEndTimeMs) { //Purposefully left blank } @@ -567,46 +521,4 @@ private void pushSurface(boolean blockForSurfacePush) { player.sendMessage(videoRenderer, MediaCodecVideoTrackRenderer.MSG_SET_SURFACE, surface); } } - - private void pushTrackSelection(int type, boolean allowRendererEnable) { - if (multiTrackSources == null) { - return; - } - - int trackIndex = selectedTracks[type]; - if (trackIndex == DISABLED_TRACK) { - player.setRendererEnabled(type, false); - } else if (multiTrackSources[type] == null) { - player.setRendererEnabled(type, allowRendererEnable); - } else { - boolean playWhenReady = player.getPlayWhenReady(); - player.setPlayWhenReady(false); - player.setRendererEnabled(type, false); - player.sendMessage(multiTrackSources[type], MultiTrackChunkSource.MSG_SELECT_TRACK, trackIndex); - player.setRendererEnabled(type, allowRendererEnable); - player.setPlayWhenReady(playWhenReady); - } - } - - private class InternalRendererBuilderCallback implements RendererBuilderCallback { - private volatile boolean canceled; - - public void cancel() { - canceled = true; - } - - @Override - public void onRenderers(String[][] trackNames, MultiTrackChunkSource[] multiTrackSources, TrackRenderer[] renderers, @Nullable BandwidthMeter bandwidthMeter) { - if (!canceled) { - EMExoPlayer.this.onRenderers(trackNames, multiTrackSources, renderers, bandwidthMeter); - } - } - - @Override - public void onRenderersError(Exception e) { - if (!canceled) { - EMExoPlayer.this.onRenderersError(e); - } - } - } } \ No newline at end of file diff --git a/library/src/main/java/com/devbrackets/android/exomedia/listener/ExoPlayerListener.java b/library/src/main/java/com/devbrackets/android/exomedia/listener/ExoPlayerListener.java index ab5b4540..d87769c4 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/listener/ExoPlayerListener.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/listener/ExoPlayerListener.java @@ -25,5 +25,5 @@ public interface ExoPlayerListener { void onError(Exception e); - void onVideoSizeChanged(int width, int height, float pixelWidthHeightRatio); + void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio); } diff --git a/library/src/main/java/com/devbrackets/android/exomedia/listener/InfoListener.java b/library/src/main/java/com/devbrackets/android/exomedia/listener/InfoListener.java index db75a24f..6f615ff4 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/listener/InfoListener.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/listener/InfoListener.java @@ -24,19 +24,19 @@ * A listener for debugging EMExoPlayer information. */ public interface InfoListener { - void onVideoFormatEnabled(Format format, int trigger, int mediaTimeMs); + void onVideoFormatEnabled(Format format, int trigger, long mediaTimeMs); - void onAudioFormatEnabled(Format format, int trigger, int mediaTimeMs); + void onAudioFormatEnabled(Format format, int trigger, long mediaTimeMs); void onDroppedFrames(int count, long elapsed); void onBandwidthSample(int elapsedMs, long bytes, long bitrateEstimate); - void onLoadStarted(int sourceId, long length, int type, int trigger, Format format, int mediaStartTimeMs, int mediaEndTimeMs); + void onLoadStarted(int sourceId, long length, int type, int trigger, Format format, long mediaStartTimeMs, long mediaEndTimeMs); - void onLoadCompleted(int sourceId, long bytesLoaded, int type, int trigger, Format format, int mediaStartTimeMs, int mediaEndTimeMs, long elapsedRealtimeMs, long loadDurationMs); + void onLoadCompleted(int sourceId, long bytesLoaded, int type, int trigger, Format format, long mediaStartTimeMs, long mediaEndTimeMs, long elapsedRealtimeMs, long loadDurationMs); void onDecoderInitialized(String decoderName, long elapsedRealtimeMs, long initializationDurationMs); - void onSeekRangeChanged(TimeRange seekRange); + void onAvailableRangeChanged(TimeRange availableRange); } diff --git a/library/src/main/java/com/devbrackets/android/exomedia/listener/RendererBuilderCallback.java b/library/src/main/java/com/devbrackets/android/exomedia/listener/RendererBuilderCallback.java deleted file mode 100644 index 1418b546..00000000 --- a/library/src/main/java/com/devbrackets/android/exomedia/listener/RendererBuilderCallback.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2015 Brian Wernick, - * Copyright (C) 2014 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.devbrackets.android.exomedia.listener; - -import android.support.annotation.Nullable; - -import com.google.android.exoplayer.TrackRenderer; -import com.google.android.exoplayer.chunk.MultiTrackChunkSource; -import com.google.android.exoplayer.upstream.BandwidthMeter; - -/** - * - */ -public interface RendererBuilderCallback { - /** - * Invoked with the results from a {@link com.devbrackets.android.exomedia.builder.RenderBuilder}. - * - * @param trackNames The names of the available tracks, indexed by {@link com.devbrackets.android.exomedia.exoplayer.EMExoPlayer} TYPE_* - * constants. May be null if the track names are unknown. An individual element may be null - * if the track names are unknown for the corresponding type. - * @param multiTrackSources Sources capable of switching between multiple available tracks, - * indexed by {@link com.devbrackets.android.exomedia.exoplayer.EMExoPlayer} TYPE_* constants. May be null if there are no types with - * multiple tracks. An individual element may be null if it does not have multiple tracks. - * @param renderers Renderers indexed by {@link com.devbrackets.android.exomedia.exoplayer.EMExoPlayer} TYPE_* constants. An individual - * element may be null if there do not exist tracks of the corresponding type. - * @param bandwidthMeter Provides an estimate of the currently available bandwidth. May be null. - */ - void onRenderers(String[][] trackNames, MultiTrackChunkSource[] multiTrackSources, TrackRenderer[] renderers, @Nullable BandwidthMeter bandwidthMeter); - /** - * Invoked if a {@link com.devbrackets.android.exomedia.builder.RenderBuilder} encounters an error. - * - * @param e Describes the error. - */ - void onRenderersError(Exception e); -}