new release

This commit is contained in:
Page Asgardius 2023-03-08 11:38:44 -07:00
parent 92f4a0f7dd
commit 8fb7d3dc8b
3 changed files with 12 additions and 8 deletions

View file

@ -9,8 +9,8 @@ android {
applicationId "asgardius.page.s3music" applicationId "asgardius.page.s3music"
minSdk 21 minSdk 21
targetSdk 33 targetSdk 33
versionCode 4 versionCode 5
versionName "0.0.1" versionName "0.0.2"
setProperty("archivesBaseName", "s3-music-$versionName") setProperty("archivesBaseName", "s3-music-$versionName")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View file

@ -26,6 +26,7 @@ import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.MediaMetadata; import com.google.android.exoplayer2.MediaMetadata;
import com.google.android.exoplayer2.PlaybackException; import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Tracks;
import com.google.android.exoplayer2.audio.AudioAttributes; import com.google.android.exoplayer2.audio.AudioAttributes;
import com.google.android.exoplayer2.database.StandaloneDatabaseProvider; import com.google.android.exoplayer2.database.StandaloneDatabaseProvider;
import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector; import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector;
@ -218,6 +219,7 @@ public class VideoPlayer extends AppCompatActivity {
player.addMediaSource(mediaSource); player.addMediaSource(mediaSource);
} }
} }
getSupportActionBar().setTitle(names.get(player.getCurrentMediaItemIndex()));
player.prepare(); player.prepare();
try { try {
player.seekTo(names.indexOf(title), 0); player.seekTo(names.indexOf(title), 0);
@ -271,6 +273,14 @@ public class VideoPlayer extends AppCompatActivity {
Player.Listener.super.onIsPlayingChanged(isPlaying); Player.Listener.super.onIsPlayingChanged(isPlaying);
} }
@Override
public void onTracksChanged(Tracks tracks) {
if(isplaylist) {
getSupportActionBar().setTitle(names.get(player.getCurrentMediaItemIndex()));
}
Player.Listener.super.onTracksChanged(tracks);
}
public void onMediaMetadataChanged(MediaMetadata mediaMetadata) { public void onMediaMetadataChanged(MediaMetadata mediaMetadata) {
//Station 5 does not display metadata //Station 5 does not display metadata
trackname = (String) mediaMetadata.title; trackname = (String) mediaMetadata.title;
@ -296,9 +306,6 @@ public class VideoPlayer extends AppCompatActivity {
mWakeLock.acquire(); mWakeLock.acquire();
//System.out.println("WakeLock acquired"); //System.out.println("WakeLock acquired");
} }
if(isplaylist) {
getSupportActionBar().setTitle(names.get(player.getCurrentMediaItemIndex()));
}
} else if (state == 2) { } else if (state == 2) {
// Buffering. // Buffering.
//Acquiring WakeLock and WifiLock if not held //Acquiring WakeLock and WifiLock if not held
@ -310,9 +317,6 @@ public class VideoPlayer extends AppCompatActivity {
mWakeLock.acquire(); mWakeLock.acquire();
//System.out.println("WakeLock acquired"); //System.out.println("WakeLock acquired");
} }
if(isplaylist) {
getSupportActionBar().setTitle(names.get(player.getCurrentMediaItemIndex()));
}
} else { } else {
//Player inactive //Player inactive
//Releasing WifiLock and WakeLock if held //Releasing WifiLock and WakeLock if held