Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
15a0d09
Add platform interface changes
FirentisTFW Jan 21, 2025
25520fc
Add platform view support for Android
FirentisTFW Jan 21, 2025
28d38c5
Rearrange native unit tests after merge
FirentisTFW Jan 21, 2025
0d3a753
Remove a todo in web implementation
FirentisTFW Jan 21, 2025
ea16d63
Set initial value of nextNonTexturePlayerId to Long.MAX_VALUE
FirentisTFW Jan 21, 2025
25425ca
Use player provider instead of modifiable list
FirentisTFW Jan 21, 2025
ce2aa51
Remove empty line
FirentisTFW Jan 21, 2025
8aeca10
Check player view states in Dart unit tests
FirentisTFW Jan 21, 2025
209f34f
Restore previous formatting for comments
FirentisTFW Jan 21, 2025
42cb659
Add missing licenses
FirentisTFW Jan 21, 2025
690ec54
Format files
FirentisTFW Jan 21, 2025
6db9e6d
Fix linting issues
FirentisTFW Jan 21, 2025
277bff7
Rename textureId to playerId in platform interace methods
FirentisTFW Jan 21, 2025
5aca5db
Rename textureId to playerId in Android Dart files
FirentisTFW Jan 21, 2025
751d529
Rename textureId to playerId in Android native code
FirentisTFW Jan 21, 2025
e6f856b
Add an ignore to UI test (it times out on Firebase Test Lab)
FirentisTFW Jan 21, 2025
b752b4c
Merge branch 'main' into feature/video-player-android-platform-view-s…
FirentisTFW Jan 28, 2025
8fc1fa0
Bump platform interface dependency to 6.3.0
FirentisTFW Jan 28, 2025
b745dcc
Remove resolved todo and fix dartdocs
FirentisTFW Jan 28, 2025
773cfc1
Add missing import
FirentisTFW Jan 28, 2025
89dfcea
Format test file
FirentisTFW Jan 28, 2025
f59463a
Add more context to class names for native views
FirentisTFW Jan 28, 2025
650cc21
Add missing docs for Android
FirentisTFW Jan 28, 2025
18463e7
Format file
FirentisTFW Jan 28, 2025
11647d0
Remove redundant async keyword
FirentisTFW Jan 29, 2025
8f9ccd8
Depend on platform interface 6.3.0
FirentisTFW Feb 10, 2025
0c2e19b
Add more details to javadocs for players
FirentisTFW Feb 10, 2025
17d5c6c
Rename method for clarity
FirentisTFW Feb 10, 2025
10640da
Remove "///" from a javadoc
FirentisTFW Feb 11, 2025
7917c0c
Add unit tests for NativeVideoView and NativeVideoViewFactory
FirentisTFW Feb 19, 2025
06b20a1
Add unit tests for VideoPlayerPlugin.create method
FirentisTFW Feb 19, 2025
1e51f8c
Add empty line to separate concepts
FirentisTFW Feb 19, 2025
e2a5afa
Clean up newly added tests
FirentisTFW Feb 19, 2025
2692564
Sort imports
FirentisTFW Feb 19, 2025
f5258df
Add missing licenses
FirentisTFW Feb 19, 2025
1bbe2c2
Split ExoPlayerEventListener into two classes, for platform view and …
FirentisTFW Feb 24, 2025
f43e9ba
Make class final
FirentisTFW Feb 24, 2025
22c9241
Use "PlatformView" instead of "NativeView" everywhere
FirentisTFW Feb 24, 2025
df3959d
Rename TextureBased to Texture, move texture player to a separate pac…
FirentisTFW Feb 24, 2025
4575c4c
Make VideoPlayer abstract
FirentisTFW Feb 24, 2025
eae1eb5
Clean up analysis
FirentisTFW Feb 24, 2025
c39b14c
Rename nextNonTexturePlayerId to nextPlatformViewPlayerId
FirentisTFW Feb 24, 2025
8d3279d
Split tests for exo player event listeners
FirentisTFW Feb 24, 2025
2862323
Update implementation comment
FirentisTFW Feb 24, 2025
314bf82
Use widget instead of a method
FirentisTFW Feb 24, 2025
feca35d
Move VideoPlayerProvider to PlatformVideoViewFactory
FirentisTFW Feb 24, 2025
7956b19
Comment on swapping width and height
FirentisTFW Feb 25, 2025
70ed428
Remove redundant abstract class method
FirentisTFW Feb 25, 2025
ce63f14
Handle SurfaceView on Android 9 correctly, document workarounds
FirentisTFW Feb 25, 2025
81a71a3
Test output, not internal state
FirentisTFW Feb 25, 2025
41891d2
Remove overriden == operator as it's not needed anymore
FirentisTFW Feb 25, 2025
6bf34e7
Clean up code
FirentisTFW Feb 25, 2025
dc08e2d
Format code
FirentisTFW Feb 25, 2025
0681400
Use custom test class in VideoPlayerTest
FirentisTFW Feb 25, 2025
b0f282d
Add missing licenses
FirentisTFW Feb 25, 2025
6c17ebc
Add a todo to decouple identifiers in the future
FirentisTFW Feb 26, 2025
9895676
Format file
FirentisTFW Feb 26, 2025
da1b78d
Resolve lint issues
FirentisTFW Feb 26, 2025
ae4bfae
Inline method
FirentisTFW Feb 26, 2025
371c462
Format file
FirentisTFW Feb 26, 2025
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
Next Next commit
Add platform interface changes
  • Loading branch information
FirentisTFW committed Jan 21, 2025
commit 15a0d09d2fafdffb1aa88b596ac99d419e8ba8f6
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 6.3.0

* Adds support for platform views as an optional way of displaying a video.
* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.

## 6.2.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,67 +44,81 @@ abstract class VideoPlayerPlatform extends PlatformInterface {
}

/// Clears one video.
Future<void> dispose(int textureId) {
Future<void> dispose(int playerId) {
throw UnimplementedError('dispose() has not been implemented.');
}

/// Creates an instance of a video player and returns its textureId.
/// Creates an instance of a video player and returns its playerId.
@Deprecated('Use createWithOptions() instead.')
Future<int?> create(DataSource dataSource) {
throw UnimplementedError('create() has not been implemented.');
}

/// Creates an instance of a video player based on creation options
/// and returns its playerId.
Future<int?> createWithOptions(VideoCreationOptions options) {
return create(options.dataSource);
}

/// Returns a Stream of [VideoEventType]s.
Stream<VideoEvent> videoEventsFor(int textureId) {
Stream<VideoEvent> videoEventsFor(int playerId) {
throw UnimplementedError('videoEventsFor() has not been implemented.');
}

/// Sets the looping attribute of the video.
Future<void> setLooping(int textureId, bool looping) {
Future<void> setLooping(int playerId, bool looping) {
throw UnimplementedError('setLooping() has not been implemented.');
}

/// Starts the video playback.
Future<void> play(int textureId) {
Future<void> play(int playerId) {
throw UnimplementedError('play() has not been implemented.');
}

/// Stops the video playback.
Future<void> pause(int textureId) {
Future<void> pause(int playerId) {
throw UnimplementedError('pause() has not been implemented.');
}

/// Sets the volume to a range between 0.0 and 1.0.
Future<void> setVolume(int textureId, double volume) {
Future<void> setVolume(int playerId, double volume) {
throw UnimplementedError('setVolume() has not been implemented.');
}

/// Sets the video position to a [Duration] from the start.
Future<void> seekTo(int textureId, Duration position) {
Future<void> seekTo(int playerId, Duration position) {
throw UnimplementedError('seekTo() has not been implemented.');
}

/// Sets the playback speed to a [speed] value indicating the playback rate.
Future<void> setPlaybackSpeed(int textureId, double speed) {
Future<void> setPlaybackSpeed(int playerId, double speed) {
throw UnimplementedError('setPlaybackSpeed() has not been implemented.');
}

/// Gets the video position as [Duration] from the start.
Future<Duration> getPosition(int textureId) {
Future<Duration> getPosition(int playerId) {
throw UnimplementedError('getPosition() has not been implemented.');
}

/// Returns a widget displaying the video with a given textureID.
Widget buildView(int textureId) {
/// Returns a widget displaying the video with a given playerId.
@Deprecated('Use buildViewWithOptions() instead.')
Widget buildView(int playerId) {
throw UnimplementedError('buildView() has not been implemented.');
}

/// Sets the audio mode to mix with other sources
/// Returns a widget displaying the video based on given options.
Widget buildViewWithOptions(VideoViewOptions options) {
// Default implementation for backwards compatibility.
return buildView(options.playerId);
}

/// Sets the audio mode to mix with other sources.
Future<void> setMixWithOthers(bool mixWithOthers) {
throw UnimplementedError('setMixWithOthers() has not been implemented.');
}

/// Sets additional options on web
Future<void> setWebOptions(int textureId, VideoPlayerWebOptions options) {
/// Sets additional options on web.
Future<void> setWebOptions(int playerId, VideoPlayerWebOptions options) {
throw UnimplementedError('setWebOptions() has not been implemented.');
}
}
Expand Down Expand Up @@ -198,6 +212,15 @@ enum VideoFormat {
other,
}

/// The type of video view to be used.
enum VideoViewType {
/// Texture will be used to render video.
textureView,

/// Platform view will be used to render video.
platformView,
}

/// Event emitted from the platform implementation.
@immutable
class VideoEvent {
Expand Down Expand Up @@ -476,3 +499,31 @@ class VideoPlayerWebOptionsControls {
return controlsList.join(' ');
}
}

/// [VideoViewOptions] contains configuration options for a video view.
@immutable
class VideoViewOptions {
/// Constructs an instance of [VideoViewOptions].
const VideoViewOptions({
required this.playerId,
});

/// The identifier of the video player.
final int playerId;
}

/// [VideoCreationOptions] contains creation options for a video player.
@immutable
class VideoCreationOptions {
/// Constructs an instance of [VideoCreationOptions].
const VideoCreationOptions({
required this.dataSource,
required this.viewType,
});

/// The data source used to create the player.
final DataSource dataSource;

/// The type of view to be used for displaying the video player
final VideoViewType viewType;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/video_player/
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 6.2.3
version: 6.3.0

environment:
sdk: ^3.4.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import 'package:web/web.dart' as web;

import 'src/video_player.dart';

// TODO(FirentisTFW): Remove the ignore and rename parameters when adding support for platform views.
// ignore_for_file: avoid_renaming_method_parameters

/// The web implementation of [VideoPlayerPlatform].
///
/// This class implements the `package:video_player` functionality for the web.
Expand Down