Skip to content
Draft
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
4 changes: 4 additions & 0 deletions packages/video_player_avplay/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.7.3
* Support parsing SMPE-TT(sidecar) subtitle attributes.
* Support image format subtitles.

## 0.7.2
* Fix type missmatch.

Expand Down
2 changes: 1 addition & 1 deletion packages/video_player_avplay/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To use this package, add `video_player_avplay` as a dependency in your `pubspec.

```yaml
dependencies:
video_player_avplay: ^0.7.2
video_player_avplay: ^0.7.3
```

Then you can import `video_player_avplay` in your Dart code:
Expand Down
96 changes: 86 additions & 10 deletions packages/video_player_avplay/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class _App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 9,
length: 10,
child: Scaffold(
key: const ValueKey<String>('home_page'),
appBar: AppBar(
Expand All @@ -39,6 +39,7 @@ class _App extends StatelessWidget {
Tab(icon: Icon(Icons.cloud), text: 'Asset'),
Tab(icon: Icon(Icons.live_tv), text: 'Live'),
Tab(icon: Icon(Icons.local_florist), text: 'ChangeURLTest'),
Tab(icon: Icon(Icons.abc), text: 'PictureCaptionTest'),
],
),
),
Expand All @@ -53,6 +54,7 @@ class _App extends StatelessWidget {
_AssetVideo(),
_LiveRemoteVideo(),
_TestRemoteVideo(),
_PictureCaptionVideo(),
],
),
),
Expand Down Expand Up @@ -107,7 +109,7 @@ class _HlsRomoteVideoState extends State<_HlsRomoteVideo> {
alignment: Alignment.bottomCenter,
children: <Widget>[
VideoPlayer(_controller),
ClosedCaption(text: _controller.value.caption.text),
ClosedCaption(text: _controller.value.textCaption.text),
_ControlsOverlay(controller: _controller),
VideoProgressIndicator(_controller, allowScrubbing: true),
],
Expand Down Expand Up @@ -155,6 +157,9 @@ class _DashRomoteVideoState extends State<_DashRomoteVideo> {
if (_controller.value.hasAdInfo) {
print(_controller.value.adInfo);
}
if (_controller.value.hasTextStyle) {
print(_controller.value.textCaption.textStyle);
}
setState(() {});
});
_controller.setLooping(true);
Expand Down Expand Up @@ -193,7 +198,9 @@ class _DashRomoteVideoState extends State<_DashRomoteVideo> {
alignment: Alignment.bottomCenter,
children: <Widget>[
VideoPlayer(_controller),
ClosedCaption(text: _controller.value.caption.text),
ClosedCaption(
text: _controller.value.textCaption.text,
textStyle: _controller.value.textCaption.textStyle),
_ControlsOverlay(controller: _controller),
VideoProgressIndicator(_controller, allowScrubbing: true),
],
Expand Down Expand Up @@ -253,7 +260,7 @@ class _Mp4RemoteVideoState extends State<_Mp4RemoteVideo> {
alignment: Alignment.bottomCenter,
children: <Widget>[
VideoPlayer(_controller),
ClosedCaption(text: _controller.value.caption.text),
ClosedCaption(text: _controller.value.textCaption.text),
_ControlsOverlay(controller: _controller),
VideoProgressIndicator(_controller, allowScrubbing: true),
],
Expand Down Expand Up @@ -325,7 +332,7 @@ class _DrmRemoteVideoState extends State<_DrmRemoteVideo> {
alignment: Alignment.bottomCenter,
children: <Widget>[
VideoPlayer(_controller),
ClosedCaption(text: _controller.value.caption.text),
ClosedCaption(text: _controller.value.textCaption.text),
_ControlsOverlay(controller: _controller),
VideoProgressIndicator(_controller, allowScrubbing: true),
],
Expand Down Expand Up @@ -391,7 +398,7 @@ class _DrmRemoteVideoState2 extends State<_DrmRemoteVideo2> {
alignment: Alignment.bottomCenter,
children: <Widget>[
VideoPlayer(_controller),
ClosedCaption(text: _controller.value.caption.text),
ClosedCaption(text: _controller.value.textCaption.text),
_ControlsOverlay(controller: _controller),
VideoProgressIndicator(_controller, allowScrubbing: true),
],
Expand Down Expand Up @@ -452,7 +459,7 @@ class _TrackTestState extends State<_TrackTest> {
alignment: Alignment.bottomCenter,
children: <Widget>[
VideoPlayer(_controller),
ClosedCaption(text: _controller.value.caption.text),
ClosedCaption(text: _controller.value.textCaption.text),
_ControlsOverlay(controller: _controller),
VideoProgressIndicator(_controller, allowScrubbing: true),
],
Expand Down Expand Up @@ -514,7 +521,7 @@ class _AssetVideoState extends State<_AssetVideo> {
alignment: Alignment.bottomCenter,
children: <Widget>[
VideoPlayer(_controller),
ClosedCaption(text: _controller.value.caption.text),
ClosedCaption(text: _controller.value.textCaption.text),
_ControlsOverlay(controller: _controller),
VideoProgressIndicator(_controller, allowScrubbing: true),
],
Expand Down Expand Up @@ -824,7 +831,7 @@ class _LiveRomoteVideoState extends State<_LiveRemoteVideo> {
alignment: Alignment.bottomCenter,
children: <Widget>[
VideoPlayer(_controller),
ClosedCaption(text: _controller.value.caption.text),
ClosedCaption(text: _controller.value.textCaption.text),
_ControlsOverlay(controller: _controller),
VideoProgressIndicator(_controller, allowScrubbing: true),
],
Expand Down Expand Up @@ -903,7 +910,76 @@ class _TestRemoteVideoState extends State<_TestRemoteVideo> {
alignment: Alignment.bottomCenter,
children: <Widget>[
VideoPlayer(_controller),
ClosedCaption(text: _controller.value.caption.text),
ClosedCaption(text: _controller.value.textCaption.text),
_ControlsOverlay(controller: _controller),
VideoProgressIndicator(_controller, allowScrubbing: true),
],
),
),
),
],
),
);
}
}

class _PictureCaptionVideo extends StatefulWidget {
@override
State<_PictureCaptionVideo> createState() => _PictureCaptionVideoState();
}

class _PictureCaptionVideoState extends State<_PictureCaptionVideo> {
late VideoPlayerController _controller;

@override
void initState() {
super.initState();
_controller = VideoPlayerController.network(
'https://livesim2.dashif.org/vod/testpic_2s/imsc1_img.mpd',
formatHint: VideoFormat.dash,
);

_controller.addListener(() {
if (_controller.value.hasError) {
print(_controller.value.errorDescription);
}
setState(() {});
});
_controller.setLooping(true);
_controller.initialize().then((_) => setState(() {}));
_controller.play();
}

@override
void dispose() {
_controller.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
children: <Widget>[
Container(padding: const EdgeInsets.only(top: 20.0)),
const Text('Picture Caption Test'),
Container(
padding: const EdgeInsets.all(20),
child: AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: Stack(
alignment: Alignment.bottomCenter,
children: <Widget>[
VideoPlayer(_controller),
ClosedCaption(
text: _controller.value.textCaption.text,
textStyle: _controller.value.textCaption.textStyle,
subtitleImage: _controller.value.pictureCaption.picture,
subtitleImageWidth:
_controller.value.pictureCaption.pictureWidth,
subtitleImageHeight:
_controller.value.pictureCaption.pictureHeight,
),
_ControlsOverlay(controller: _controller),
VideoProgressIndicator(_controller, allowScrubbing: true),
],
Expand Down
Loading