Skip to content

Commit

Permalink
Merge branch 'feature/constant_bitrate_seeking' into minor
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanheise committed May 28, 2022
2 parents f6f819e + 30f2599 commit f99ab3c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
4 changes: 4 additions & 0 deletions just_audio/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.9.23

* Fallback to constant bitrate seeking on Android.

## 0.9.22

* Migrate to Flutter 3, Xcode 13, ExoPlayer 2.17.1.
Expand Down
4 changes: 2 additions & 2 deletions just_audio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,15 +384,15 @@ The macOS player relies on server headers (e.g. `Content-Type`, `Content-Length`
Windows support is enabled by adding an additional dependency to your `pubspec.yaml` alongside `just_audio`. There are a number of alternative options:

* [just_audio_mpv](https://pub.dev/packages/just_audio_mpv)
* [just_audio_windows](https://pub.dev/packages/just_audio_windows)
* [just_audio_libwinmedia](https://pub.dev/packages/just_audio_libwinmedia)
* [just_audio_windows](https://github.com/bdlukaa/just_audio/tree/master/just_audio_windows) (BETA - to supersede just_audio_libwinmedia)

Example:

```yaml
dependencies:
just_audio: any # substitute version number
just_audio_libwinmedia: any # substitute version number
just_audio_windows: any # substitute version number
```
For issues with the Windows implementation, please open an issue on the respective implementation's GitHub issues page.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.TracksInfo;
import com.google.android.exoplayer2.audio.AudioAttributes;
import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory;
import com.google.android.exoplayer2.metadata.Metadata;
import com.google.android.exoplayer2.metadata.MetadataOutput;
import com.google.android.exoplayer2.metadata.icy.IcyHeaders;
Expand Down Expand Up @@ -97,6 +98,7 @@ public class AudioPlayer implements MethodCallHandler, Player.Listener, Metadata
private Map<String, Object> pendingPlaybackEvent;

private ExoPlayer player;
private DefaultExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
private Integer audioSessionId;
private MediaSource mediaSource;
private Integer currentIndex;
Expand Down Expand Up @@ -138,6 +140,7 @@ public AudioPlayer(final Context applicationContext, final BinaryMessenger messe
eventChannel = new BetterEventChannel(messenger, "com.ryanheise.just_audio.events." + id);
dataEventChannel = new BetterEventChannel(messenger, "com.ryanheise.just_audio.data." + id);
processingState = ProcessingState.none;
extractorsFactory.setConstantBitrateSeekingEnabled(true);
if (audioLoadConfiguration != null) {
Map<?, ?> loadControlMap = (Map<?, ?>)audioLoadConfiguration.get("androidLoadControl");
if (loadControlMap != null) {
Expand Down Expand Up @@ -587,7 +590,7 @@ private MediaSource decodeAudioSource(final Object json) {
String id = (String)map.get("id");
switch ((String)map.get("type")) {
case "progressive":
return new ProgressiveMediaSource.Factory(buildDataSourceFactory())
return new ProgressiveMediaSource.Factory(buildDataSourceFactory(), extractorsFactory)
.createMediaSource(new MediaItem.Builder()
.setUri(Uri.parse((String)map.get("uri")))
.setTag(id)
Expand Down
1 change: 1 addition & 0 deletions just_audio/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class MyAppState extends State<MyApp> with WidgetsBindingObserver {
});
// Try to load audio from a source and catch any errors.
try {
// AAC example: https://dl.espressif.com/dl/audio/ff-16b-2c-44100hz.aac
await _player.setAudioSource(AudioSource.uri(Uri.parse(
"https://s3.amazonaws.com/scifri-episodes/scifri20181123-episode.mp3")));
} catch (e) {
Expand Down
5 changes: 1 addition & 4 deletions just_audio/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ dependencies:
rxdart: '^0.27.0'
just_audio_mpv: ^0.1.1
# Other platform implementations below:
# just_audio_windows: ^0.1.0
# just_audio_libwinmedia: ^0.0.4
# just_audio_windows:
# git:
# url: https://github.com/bdlukaa/just_audio.git
# path: just_audio_windows
just_audio:
path: ../

Expand Down
2 changes: 1 addition & 1 deletion just_audio/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: just_audio
description: A feature-rich audio player for Flutter. Loop, clip and concatenate any sound from any source (asset/file/URL/stream) in a variety of audio formats with gapless playback.
version: 0.9.22
version: 0.9.23
homepage: https://github.com/ryanheise/just_audio/tree/master/just_audio

environment:
Expand Down

0 comments on commit f99ab3c

Please sign in to comment.