Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated ExoPlayer to 2.18.1 #21

Merged
merged 1 commit into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,320 changes: 655 additions & 665 deletions Xamarin.ExoPlayerSlim.UsageChecker/Resources/Resource.designer.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.4.0.4" />
<PackageReference Include="Xamarin.Essentials" Version="1.6.1" />
<PackageReference Include="Xamarin.ExoPlayerSlim">
<Version>2.16.1.14</Version>
<Version>2.18.1.3</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
48 changes: 0 additions & 48 deletions Xamarin.ExoPlayerSlim/Additions/AboutAdditions.txt

This file was deleted.

24 changes: 0 additions & 24 deletions Xamarin.ExoPlayerSlim/Jars/AboutJars.txt

This file was deleted.

14 changes: 0 additions & 14 deletions Xamarin.ExoPlayerSlim/Transforms/EnumFields.xml

This file was deleted.

13 changes: 0 additions & 13 deletions Xamarin.ExoPlayerSlim/Transforms/EnumMethods.xml

This file was deleted.

9 changes: 0 additions & 9 deletions Xamarin.ExoPlayerSlim/Transforms/Metadata.xml

This file was deleted.

15 changes: 3 additions & 12 deletions Xamarin.ExoPlayerSlim/Xamarin.ExoPlayerSlim.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<IsPackable>true</IsPackable>
<PackageId>Xamarin.ExoPlayerSlim</PackageId>
<Version>2.16.1.14</Version>
<Version>2.18.1.3</Version>
<Description>Contains bindings for https://exoplayer.dev</Description>
<Authors>Christian Kapplmüller</Authors>
<Company>fun.music IT GmbH</Company>
Expand Down Expand Up @@ -59,15 +59,6 @@
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Jars\AboutJars.txt" />
<None Include="Additions\AboutAdditions.txt" />
</ItemGroup>
<ItemGroup>
<TransformFile Include="Transforms\Metadata.xml" />
<TransformFile Include="Transforms\EnumFields.xml" />
<TransformFile Include="Transforms\EnumMethods.xml" />
</ItemGroup>
<ItemGroup>
<AndroidStudioProject Include="$(ExoPlayerJavaProjectPath)" Module="exoplayerslim" GenerateBinding="True" />
</ItemGroup>
Expand All @@ -76,11 +67,11 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="NuGet.Build.Tasks.Pack" Version="6.0.0">
<PackageReference Include="NuGet.Build.Tasks.Pack" Version="6.3.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Xamarin.Google.Guava" Version="28.2.0.1" />
<PackageReference Include="Xamarin.Google.Guava" Version="31.1.0.4" />
<PackageReference Include="Xamarin.AndroidX.Annotation" Version="1.3.0.1" />
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.3.1.3" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.4.0.4" />
Expand Down
2 changes: 1 addition & 1 deletion java/ExoPlayerSlim/exoplayerslim/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ android {
dependencies {

implementation 'androidx.annotation:annotation:1.3.0'
implementation 'com.google.android.exoplayer:exoplayer:2.16.1'
implementation 'com.google.android.exoplayer:exoplayer:2.18.1'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
testImplementation 'junit:junit:4.+'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,28 @@ public class AspectRatios {
private AspectRatios() {
}

/**
* Either the width or height is decreased to obtain the desired aspect ratio.
*/
public static final int Fit = 0;

/**
* The width is fixed and the height is increased or decreased to obtain the desired aspect ratio.
*/
public static final int FixedWidth = 1;

/**
* The height is fixed and the width is increased or decreased to obtain the desired aspect ratio.
*/
public static final int FixedHeight = 2;

/**
* The specified aspect ratio is ignored.
*/
public static final int Fill = 3;

/**
* Either the width or height is increased to obtain the desired aspect ratio.
*/
public static final int Zoom = 4;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.content.Context;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.google.android.exoplayer2.C;
Expand All @@ -12,7 +13,7 @@
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.audio.AudioAttributes;
import com.google.android.exoplayer2.ui.PlayerView;
import com.google.android.exoplayer2.ui.StyledPlayerView;

import java.util.ArrayList;
import java.util.Collections;
Expand All @@ -31,7 +32,7 @@ public ExoPlayerSlimImpl(Context context) {
player = new ExoPlayer.Builder(context, renderersFactory).build();
player.setAudioAttributes(new AudioAttributes.Builder()
.setUsage(C.USAGE_MEDIA)
.setContentType(C.CONTENT_TYPE_MUSIC)
.setContentType(C.AUDIO_CONTENT_TYPE_MUSIC)
.build(), true);
player.setHandleAudioBecomingNoisy(true);
player.setWakeMode(C.WAKE_MODE_NONE);
Expand Down Expand Up @@ -68,7 +69,10 @@ public void pause() {

@Override
public void stop(boolean reset) {
player.stop(reset);
player.stop();
if (reset) {
player.clearMediaItems();
}
}

@Override
Expand Down Expand Up @@ -111,10 +115,10 @@ public void attachPlayerView(View playerView, boolean useNativeControls, int asp
if (playerView == null) {
throw new NullPointerException("playerView must not be null");
}
if (!(playerView instanceof PlayerView)) {
if (!(playerView instanceof StyledPlayerView)) {
throw new ClassCastException("playerView is not instance of PlayerView");
}
PlayerView actualPlayerView = (PlayerView) playerView;
StyledPlayerView actualPlayerView = (StyledPlayerView) playerView;
actualPlayerView.setUseController(useNativeControls);
actualPlayerView.setResizeMode(aspectRatio);
actualPlayerView.setPlayer(player);
Expand All @@ -125,13 +129,13 @@ public void detachPlayerView(View playerView) {
if (playerView == null) {
return;
}
if (!(playerView instanceof PlayerView)) {
if (!(playerView instanceof StyledPlayerView)) {
throw new ClassCastException("playerView is not instance of PlayerView");
}
PlayerView actualPlayerView = (PlayerView) playerView;
StyledPlayerView actualPlayerView = (StyledPlayerView) playerView;
actualPlayerView.setPlayer(null);
actualPlayerView.setUseController(false);
actualPlayerView.setResizeMode((int)AspectRatios.Fit);
actualPlayerView.setResizeMode((int) AspectRatios.Fit);
}

@Override
Expand All @@ -149,7 +153,7 @@ public DelegatingPlayerListener(ExoPlayerSlimImpl exoPlayerSlim) {
}

@Override
public void onPlayerError(PlaybackException error) {
public void onPlayerError(@NonNull PlaybackException error) {
exoPlayerSlim.notifyPlayerError(error);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import android.content.Context;
import android.view.View;

import com.google.android.exoplayer2.ui.PlayerView;
import com.google.android.exoplayer2.ui.StyledPlayerView;

public class ExoPlayerSlimViewFactory {

private ExoPlayerSlimViewFactory() {
}

public static View create(Context context) {
return new PlayerView(context);
return new StyledPlayerView(context);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,24 @@ private PlaybackStates() {
}

/**
* The player does not have any media to play.
* The player is idle, meaning it holds only limited resources. The player must be {@link
* #prepare() prepared} before it will play the media.
*/
public static final int STATE_IDLE = 1;

/**
* The player is not able to immediately play from its current position. This state typically
* occurs when more data needs to be loaded.
* The player is not able to immediately play the media, but is doing work toward being able to do
* so. This state typically occurs when the player needs to buffer more data before playback can
* start.
*/
public static final int STATE_BUFFERING = 2;

/**
* The player is able to immediately play from its current position. The player will be playing if
* {@link #getPlayWhenReady()} is true, and paused otherwise.
*/
public static final int STATE_READY = 3;

/**
* The player has finished playing the media.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
package com.tonestro.exoplayerslim;

import com.google.android.exoplayer2.MediaItem;

public class RepeatModes {

private RepeatModes() {
}

/**
* Normal playback without repetition. "Previous" and "Next" actions move to the previous and next
* windows respectively, and do nothing when there is no previous or next window to move to.
* {@link MediaItem} respectively, and do nothing when there is no previous or next {@link
* MediaItem} to move to.
*/
public static final int REPEAT_MODE_OFF = 0;

/**
* Repeats the currently playing window infinitely during ongoing playback. "Previous" and "Next"
* actions behave as they do in {@link #REPEAT_MODE_OFF}, moving to the previous and next windows
* respectively, and doing nothing when there is no previous or next window to move to.
* Repeats the currently playing {@link MediaItem} infinitely during ongoing playback. "Previous"
* and "Next" actions behave as they do in {@link #REPEAT_MODE_OFF}, moving to the previous and
* next {@link MediaItem} respectively, and doing nothing when there is no previous or next {@link
* MediaItem} to move to.
*/
public static final int REPEAT_MODE_ONE = 1;

/**
* Repeats the entire timeline infinitely. "Previous" and "Next" actions behave as they do in
* {@link #REPEAT_MODE_OFF}, but with looping at the ends so that "Previous" when playing the
* first window will move to the last window, and "Next" when playing the last window will move to
* the first window.
* first {@link MediaItem} will move to the last {@link MediaItem}, and "Next" when playing the
* last {@link MediaItem} will move to the first {@link MediaItem}.
*/
public static final int REPEAT_MODE_ALL = 2;
}