-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[video_player] Relands #6456: Uses SurfaceProducer
, this time with setCallback
for suspend/resume lifecycles.
#6989
Merged
auto-submit
merged 18 commits into
main
from
video-player-android-surface-producer-redo
Aug 24, 2024
Merged
Changes from 13 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
fea9087
Further refactor and add test coverage for video_player_android.
matanlurey eb5be68
Merge remote-tracking branch 'origin/main' into video-player-android-…
matanlurey 892115e
++ for draft review.
matanlurey deb7d4b
Javafmt.
matanlurey e0f663c
Address android_lint.
matanlurey 796fedc
Add back missing gradle dependency thingy.
matanlurey 0516633
Address feedback.
matanlurey 9bd2beb
Revert pubspec override.
matanlurey 3dd75ec
Add resume/suspend using the new SurfaceProducer.Callback APIs.
matanlurey 65c080e
Merge remote-tracking branch 'origin/main' into video-player-android-…
matanlurey a1dfdcf
Fmt.
matanlurey 0e8ddac
Merge remote-tracking branch 'upstream/main' into video-player-androi…
matanlurey 3d7bc67
Delint and stuff.
matanlurey 064d40f
Delint.
matanlurey b07e1e2
Try another approach.
matanlurey cd573f1
++
matanlurey f457a3a
++
matanlurey f770bdb
Merge remote-tracking branch 'upstream/main' into video-player-androi…
matanlurey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
118 changes: 61 additions & 57 deletions
118
packages/video_player/video_player_android/CHANGELOG.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,172 +1,176 @@ | ||
## 2.7.0 | ||
|
||
- Re-adds [support for Impeller](https://docs.flutter.dev/release/breaking-changes/android-surface-plugins). | ||
|
||
## 2.6.0 | ||
|
||
* Adds RTSP support. | ||
- Adds RTSP support. | ||
|
||
## 2.5.4 | ||
|
||
* Updates Media3-ExoPlayer to 1.4.0. | ||
- Updates Media3-ExoPlayer to 1.4.0. | ||
|
||
## 2.5.3 | ||
|
||
* Updates lint checks to ignore NewerVersionAvailable. | ||
- Updates lint checks to ignore NewerVersionAvailable. | ||
|
||
## 2.5.2 | ||
|
||
* Updates Android Gradle plugin to 8.5.0. | ||
- Updates Android Gradle plugin to 8.5.0. | ||
|
||
## 2.5.1 | ||
|
||
* Removes additional references to the v1 Android embedding. | ||
- Removes additional references to the v1 Android embedding. | ||
|
||
## 2.5.0 | ||
|
||
* Migrates ExoPlayer to Media3-ExoPlayer 1.3.1. | ||
- Migrates ExoPlayer to Media3-ExoPlayer 1.3.1. | ||
|
||
## 2.4.17 | ||
|
||
* Revert Impeller support. | ||
- Revert Impeller support. | ||
|
||
## 2.4.16 | ||
|
||
* [Supports Impeller](https://docs.flutter.dev/release/breaking-changes/android-surface-plugins). | ||
- [Supports Impeller](https://docs.flutter.dev/release/breaking-changes/android-surface-plugins). | ||
|
||
## 2.4.15 | ||
|
||
* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. | ||
* Removes support for apps using the v1 Android embedding. | ||
- Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. | ||
- Removes support for apps using the v1 Android embedding. | ||
|
||
## 2.4.14 | ||
|
||
* Calls `onDestroy` instead of `initialize` in onDetachedFromEngine. | ||
- Calls `onDestroy` instead of `initialize` in onDetachedFromEngine. | ||
|
||
## 2.4.13 | ||
|
||
* Updates minSdkVersion to 19. | ||
* Updates minimum supported SDK version to Flutter 3.16/Dart 3.2. | ||
- Updates minSdkVersion to 19. | ||
- Updates minimum supported SDK version to Flutter 3.16/Dart 3.2. | ||
|
||
## 2.4.12 | ||
|
||
* Updates compileSdk version to 34. | ||
* Adds error handling for `BehindLiveWindowException`, which may occur upon live-video playback failure. | ||
- Updates compileSdk version to 34. | ||
- Adds error handling for `BehindLiveWindowException`, which may occur upon live-video playback failure. | ||
|
||
## 2.4.11 | ||
|
||
* Updates minimum supported SDK version to Flutter 3.10/Dart 3.0. | ||
* Fixes new lint warnings. | ||
- Updates minimum supported SDK version to Flutter 3.10/Dart 3.0. | ||
- Fixes new lint warnings. | ||
|
||
## 2.4.10 | ||
|
||
* Adds pub topics to package metadata. | ||
* Updates minimum supported SDK version to Flutter 3.7/Dart 2.19. | ||
- Adds pub topics to package metadata. | ||
- Updates minimum supported SDK version to Flutter 3.7/Dart 2.19. | ||
|
||
## 2.4.9 | ||
|
||
* Bumps ExoPlayer version to 2.18.7. | ||
- Bumps ExoPlayer version to 2.18.7. | ||
|
||
## 2.4.8 | ||
|
||
* Bumps ExoPlayer version to 2.18.6. | ||
- Bumps ExoPlayer version to 2.18.6. | ||
|
||
## 2.4.7 | ||
|
||
* Fixes Java warnings. | ||
- Fixes Java warnings. | ||
|
||
## 2.4.6 | ||
|
||
* Fixes compatibility with AGP versions older than 4.2. | ||
- Fixes compatibility with AGP versions older than 4.2. | ||
|
||
## 2.4.5 | ||
|
||
* Adds a namespace for compatibility with AGP 8.0. | ||
- Adds a namespace for compatibility with AGP 8.0. | ||
|
||
## 2.4.4 | ||
|
||
* Synchronizes `VideoPlayerValue.isPlaying` with `ExoPlayer`. | ||
* Updates minimum Flutter version to 3.3. | ||
- Synchronizes `VideoPlayerValue.isPlaying` with `ExoPlayer`. | ||
- Updates minimum Flutter version to 3.3. | ||
|
||
## 2.4.3 | ||
|
||
* Bumps ExoPlayer version to 2.18.5. | ||
- Bumps ExoPlayer version to 2.18.5. | ||
|
||
## 2.4.2 | ||
|
||
* Bumps ExoPlayer version to 2.18.4. | ||
- Bumps ExoPlayer version to 2.18.4. | ||
|
||
## 2.4.1 | ||
|
||
* Changes the severity of `javac` warnings so that they are treated as errors and fixes the violations. | ||
- Changes the severity of `javac` warnings so that they are treated as errors and fixes the violations. | ||
|
||
## 2.4.0 | ||
|
||
* Allows setting the ExoPlayer user agent by passing a User-Agent HTTP header. | ||
- Allows setting the ExoPlayer user agent by passing a User-Agent HTTP header. | ||
|
||
## 2.3.12 | ||
|
||
* Clarifies explanation of endorsement in README. | ||
* Aligns Dart and Flutter SDK constraints. | ||
* Updates compileSdkVersion to 33. | ||
- Clarifies explanation of endorsement in README. | ||
- Aligns Dart and Flutter SDK constraints. | ||
- Updates compileSdkVersion to 33. | ||
|
||
## 2.3.11 | ||
|
||
* Updates links for the merge of flutter/plugins into flutter/packages. | ||
* Updates minimum Flutter version to 3.0. | ||
- Updates links for the merge of flutter/plugins into flutter/packages. | ||
- Updates minimum Flutter version to 3.0. | ||
|
||
## 2.3.10 | ||
|
||
* Adds compatibilty with version 6.0 of the platform interface. | ||
* Fixes file URI construction in example. | ||
* Updates code for new analysis options. | ||
* Updates code for `no_leading_underscores_for_local_identifiers` lint. | ||
* Updates minimum Flutter version to 2.10. | ||
* Fixes violations of new analysis option use_named_constants. | ||
* Removes an unnecessary override in example code. | ||
- Adds compatibilty with version 6.0 of the platform interface. | ||
- Fixes file URI construction in example. | ||
- Updates code for new analysis options. | ||
- Updates code for `no_leading_underscores_for_local_identifiers` lint. | ||
- Updates minimum Flutter version to 2.10. | ||
- Fixes violations of new analysis option use_named_constants. | ||
- Removes an unnecessary override in example code. | ||
|
||
## 2.3.9 | ||
|
||
* Updates ExoPlayer to 2.18.1. | ||
* Fixes avoid_redundant_argument_values lint warnings and minor typos. | ||
- Updates ExoPlayer to 2.18.1. | ||
- Fixes avoid_redundant_argument_values lint warnings and minor typos. | ||
|
||
## 2.3.8 | ||
|
||
* Updates ExoPlayer to 2.18.0. | ||
- Updates ExoPlayer to 2.18.0. | ||
|
||
## 2.3.7 | ||
|
||
* Bumps gradle version to 7.2.1. | ||
* Ignores unnecessary import warnings in preparation for [upcoming Flutter changes](https://github.com/flutter/flutter/pull/106316). | ||
- Bumps gradle version to 7.2.1. | ||
- Ignores unnecessary import warnings in preparation for [upcoming Flutter changes](https://github.com/flutter/flutter/pull/106316). | ||
|
||
## 2.3.6 | ||
|
||
* Updates references to the obsolete master branch. | ||
- Updates references to the obsolete master branch. | ||
|
||
## 2.3.5 | ||
|
||
* Sets rotationCorrection for videos recorded in landscapeRight (https://github.com/flutter/flutter/issues/60327). | ||
- Sets rotationCorrection for videos recorded in landscapeRight (https://github.com/flutter/flutter/issues/60327). | ||
|
||
## 2.3.4 | ||
|
||
* Updates ExoPlayer to 2.17.1. | ||
- Updates ExoPlayer to 2.17.1. | ||
|
||
## 2.3.3 | ||
|
||
* Removes unnecessary imports. | ||
* Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors | ||
- Removes unnecessary imports. | ||
- Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors | ||
lint warnings. | ||
|
||
## 2.3.2 | ||
|
||
* Updates ExoPlayer to 2.17.0. | ||
- Updates ExoPlayer to 2.17.0. | ||
|
||
## 2.3.1 | ||
|
||
* Renames internal method channels to avoid potential confusion with the | ||
- Renames internal method channels to avoid potential confusion with the | ||
default implementation's method channel. | ||
* Updates Pigeon to 2.0.1. | ||
- Updates Pigeon to 2.0.1. | ||
|
||
## 2.3.0 | ||
|
||
* Updates Pigeon to ^1.0.16. | ||
- Updates Pigeon to ^1.0.16. | ||
|
||
## 2.2.17 | ||
|
||
* Splits from `video_player` as a federated implementation. | ||
- Splits from `video_player` as a federated implementation. |
69 changes: 69 additions & 0 deletions
69
...o_player_android/android/src/main/java/io/flutter/plugins/videoplayer/ExoPlayerState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package io.flutter.plugins.videoplayer; | ||
|
||
import androidx.media3.common.PlaybackParameters; | ||
import androidx.media3.exoplayer.ExoPlayer; | ||
|
||
/** | ||
* Internal state representing an {@link ExoPlayer} instance at a snapshot in time. | ||
* | ||
* <p>During the Android application lifecycle, the underlying {@link android.view.Surface} being | ||
* rendered to by the player can be destroyed when the application is in the background and memory | ||
* is reclaimed. Upon <em>resume</em>, the player will need to be recreated, but start again at the | ||
* previous point (and settings). | ||
*/ | ||
final class ExoPlayerState { | ||
/** | ||
* Saves a representation of the current state of the player at the current point in time. | ||
* | ||
* <p>The inverse of this operation is {@link #restore(ExoPlayer)}. | ||
* | ||
* @param exoPlayer the active player instance. | ||
* @return an opaque object representing the state. | ||
*/ | ||
static ExoPlayerState save(ExoPlayer exoPlayer) { | ||
return new ExoPlayerState( | ||
/*position=*/ exoPlayer.getCurrentPosition(), | ||
/*repeatMode=*/ exoPlayer.getRepeatMode(), | ||
/*volume=*/ exoPlayer.getVolume(), | ||
/*playbackParameters=*/ exoPlayer.getPlaybackParameters()); | ||
} | ||
|
||
private ExoPlayerState( | ||
long position, int repeatMode, float volume, PlaybackParameters playbackParameters) { | ||
this.position = position; | ||
this.repeatMode = repeatMode; | ||
this.volume = volume; | ||
this.playbackParameters = playbackParameters; | ||
} | ||
|
||
/** Previous value of {@link ExoPlayer#getCurrentPosition()}. */ | ||
private final long position; | ||
|
||
/** Previous value of {@link ExoPlayer#getRepeatMode()}. */ | ||
private final int repeatMode; | ||
|
||
/** Previous value of {@link ExoPlayer#getVolume()}. */ | ||
private final float volume; | ||
|
||
/** Previous value of {@link ExoPlayer#getPlaybackParameters()}. */ | ||
private final PlaybackParameters playbackParameters; | ||
|
||
/** | ||
* Restores the captured state onto the provided player. | ||
* | ||
* <p>This will typically be done after creating a new player, setting up a media source, and | ||
* listening to events. | ||
* | ||
* @param exoPlayer the new player instance to reflect the state back to. | ||
*/ | ||
void restore(ExoPlayer exoPlayer) { | ||
exoPlayer.seekTo(position); | ||
exoPlayer.setRepeatMode(repeatMode); | ||
exoPlayer.setVolume(volume); | ||
exoPlayer.setPlaybackParameters(playbackParameters); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for the change to
-
instead of*
? I believe every other package uses*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, happy to change back.