-
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] Updates minimum supported SDK #7498
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a718f50
Updates minimum supported SDK
abdelaziz-mahdy 41d46e5
Merge branch 'main' of https://github.com/flutter/packages into min-sdk
abdelaziz-mahdy 396d1f4
pull revert changes
abdelaziz-mahdy f7b984b
Revert "Revert "[video_player] Relands #6456: Uses SurfaceProducer, t…
abdelaziz-mahdy 749f417
update change log
abdelaziz-mahdy 9d40611
Merge branch 'main' into min-sdk
abdelaziz-mahdy 6651fba
fix dart version bound
abdelaziz-mahdy b3366af
Merge branch 'min-sdk' of https://github.com/zezo357/packages into mi…
abdelaziz-mahdy 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
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
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); | ||
} | ||
} |
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
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
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
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
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.
In the future please make sure that the list under a given version is one list with one or more entries, not multiple separate lists of one item each, which renders differently on pub.dev.
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.
Oh I am sorry for that want me to issue a pr fixing that?
If yes, what should be the updated version number
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.
No, CHANGELOG formatting isn't something that we would do another release for unless it were extremely broken.
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.
Ok thank you for letting me know I will make sure it's correct next time.