Skip to content

Commit dbe9149

Browse files
authored
[video_player] Never return empty error messages (#262)
1 parent 13a41e1 commit dbe9149

File tree

12 files changed

+52
-27
lines changed

12 files changed

+52
-27
lines changed

packages/video_player/CHANGELOG.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,28 @@
44

55
## 2.0.0
66

7-
* Appaly new common texture APIs
7+
* Appaly new common texture APIs.
88

99
## 2.0.1
1010

11-
* Update integration_test
11+
* Update integration_test.
1212

1313
## 2.2.0
1414

15-
* Update video_player to 2.2.3
16-
* Update platform interface to 4.2.0
15+
* Update video_player to 2.2.3.
16+
* Update platform interface to 4.2.0.
1717

1818
## 2.2.1
1919

20-
* Update README
20+
* Update README.
2121

2222
## 2.2.2
2323

2424
* Fix `seekTo` so that it returns when seeking is completed.
25+
26+
## 2.3.0
27+
28+
* Fix a freezing issue on Flutter 2.5 or above.
29+
* Never return empty error messages to avoid null reference exceptions.
30+
* Update video_player to 2.2.6 and update the example app.
31+
* Minor cleanups.

packages/video_player/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The Tizen implementation of [`video_player`](https://github.com/flutter/plugins/
44

55
## Required privileges
66

7-
To use this plugin in a Tizen application, the mediastorage, externalstorage and internet privileges are required. Add below lines under the `<manifest>` section in your `tizen-manifest.xml` file.
7+
To use this plugin in a Tizen application, you may need to declare the following privileges in your `tizen-manifest.xml` file.
88

99
```xml
1010
<privileges>
@@ -14,20 +14,20 @@ To use this plugin in a Tizen application, the mediastorage, externalstorage and
1414
</privileges>
1515
```
1616

17-
- The mediastorage privilege (`http://tizen.org/privilege/mediastorage`) must be added to play video files located in the internal storage.
18-
- The externalstorage privilege (`http://tizen.org/privilege/externalstorage`) must be added to play video files located in the external storage.
19-
- The internet privilege (`http://tizen.org/privilege/internet`) must be added to play any URLs from network.
17+
- The mediastorage privilege (`http://tizen.org/privilege/mediastorage`) is required to play video files located in the internal storage.
18+
- The externalstorage privilege (`http://tizen.org/privilege/externalstorage`) is required to play video files located in the external storage.
19+
- The internet privilege (`http://tizen.org/privilege/internet`) is required to play any URLs from network.
2020

21-
For details, see [Security and API Privileges](https://docs.tizen.org/application/dotnet/tutorials/sec-privileges).
21+
For detailed information on Tizen privileges, see [Tizen Docs: API Privileges](https://docs.tizen.org/application/dotnet/get-started/api-privileges).
2222

2323
## Usage
2424

2525
This package is not an _endorsed_ implementation of `video_player`. Therefore, you have to include `video_player_tizen` alongside `video_player` as dependencies in your `pubspec.yaml` file.
2626

2727
```yaml
2828
dependencies:
29-
video_player: ^2.2.3
30-
video_player_tizen: ^2.2.2
29+
video_player: ^2.2.6
30+
video_player_tizen: ^2.3.0
3131
```
3232
3333
Then you can import `video_player` in your Dart code:
@@ -36,14 +36,14 @@ Then you can import `video_player` in your Dart code:
3636
import 'package:video_player/video_player.dart';
3737
```
3838

39-
For how to use the plugin, see https://github.com/flutter/plugins/tree/master/packages/video_player/video_player#usage.
39+
For how to use the plugin, see https://github.com/flutter/plugins/tree/master/packages/video_player/video_player#example.
4040

4141
## Limitations
4242

43-
The 'httpheaders' option for 'VideoPlayerController.network' and 'mixWithOthers' option of 'VideoPlayerOptions' will be silently ignored in Tizen platform.
43+
The `httpHeaders` option of `VideoPlayerController.network` and the `mixWithOthers` option of `VideoPlayerOptions` will be silently ignored in Tizen platform.
4444

45-
This plugin has some limitations on TV:
45+
This plugin has some limitations on TV devices.
4646

47-
- The 'setPlaybackSpeed' method will fail if triggered within last 3 seconds.
47+
- The `setPlaybackSpeed` method will fail if triggered within last 3 seconds.
4848
- The playback speed will reset to 1.0 when video is replayed in loop mode.
49-
- The 'seekTo' method works only when playback speed is 1.0, and it sets video position to the nearest key frame which may differ from the passed argument.
49+
- The `seekTo` method works only when playback speed is 1.0, and it sets video position to the nearest key frame which may differ from the passed argument.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
WEBVTT
2+
3+
00:00:00.200 --> 00:00:01.750
4+
[ Birds chirping ]
5+
6+
00:00:02.300 --> 00:00:05.000
7+
[ Buzzing ]

packages/video_player/example/lib/main.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
/// An example of using the plugin, controlling lifecycle and playback of the
88
/// video.
9-
109
import 'package:flutter/cupertino.dart';
1110
import 'package:flutter/material.dart';
1211
import 'package:video_player/video_player.dart';
@@ -210,8 +209,9 @@ class _BumbleBeeRemoteVideoState extends State<_BumbleBeeRemoteVideo> {
210209

211210
Future<ClosedCaptionFile> _loadCaptions() async {
212211
final String fileContents = await DefaultAssetBundle.of(context)
213-
.loadString('assets/bumble_bee_captions.srt');
214-
return SubRipCaptionFile(fileContents);
212+
.loadString('assets/bumble_bee_captions.vtt');
213+
return WebVTTCaptionFile(
214+
fileContents); // For vtt files, use WebVTTCaptionFile
215215
}
216216

217217
@override
@@ -297,6 +297,7 @@ class _ControlsOverlay extends StatelessWidget {
297297
Icons.play_arrow,
298298
color: Colors.white,
299299
size: 100.0,
300+
semanticLabel: 'Play',
300301
),
301302
),
302303
),

packages/video_player/example/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ flutter:
2626
- assets/flutter-mark-square-64.png
2727
- assets/Butterfly-209.mp4
2828
- assets/bumble_bee_captions.srt
29+
- assets/bumble_bee_captions.vtt
2930
uses-material-design: true
3031

3132
environment:

packages/video_player/example/tizen/Runner.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Tizen.NET.Sdk/1.1.5">
1+
<Project Sdk="Tizen.NET.Sdk/1.1.6">
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>

packages/video_player/example/tizen/tizen-manifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest package="org.tizen.video_player_tizen_example" version="1.0.0" api-version="4.0" xmlns="http://tizen.org/ns/packages">
33
<profile name="common"/>
4-
<ui-application appid="org.tizen.video_player_tizen_example" exec="Runner.dll" type="dotnet" multiple="false" taskmanage="true" nodisplay="false" api-version="4" launch_mode="single">
4+
<ui-application appid="org.tizen.video_player_tizen_example" exec="Runner.dll" type="dotnet" multiple="false" taskmanage="true" nodisplay="false" api-version="4">
55
<label>video_player_tizen_example</label>
66
<icon>ic_launcher.png</icon>
77
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true"/>

packages/video_player/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Flutter plugin for displaying inline video with other Flutter
33
widgets on Tizen.
44
homepage: https://github.com/flutter-tizen/plugins
55
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/video_player
6-
version: 2.2.2
6+
version: 2.3.0
77

88
flutter:
99
plugin:

packages/video_player/tizen/src/message.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
#include <flutter/binary_messenger.h>
55
#include <flutter/encodable_value.h>
66

7+
#include <functional>
8+
#include <string>
9+
710
#include "video_player_error.h"
811

912
class TextureMessage {

packages/video_player/tizen/src/video_player.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,8 @@ void VideoPlayer::onInterrupted(player_interrupted_code_e code, void *data) {
528528

529529
if (player->event_sink_) {
530530
LOG_INFO("[VideoPlayer.onInterrupted] send error event");
531-
player->event_sink_->Error("Video player is interrupted", "");
531+
player->event_sink_->Error("Interrupted error",
532+
"Video player has been interrupted.");
532533
}
533534
}
534535

@@ -539,8 +540,7 @@ void VideoPlayer::onErrorOccurred(int code, void *data) {
539540

540541
if (player->event_sink_) {
541542
LOG_INFO("[VideoPlayer.onErrorOccurred] send error event");
542-
player->event_sink_->Error("Video player had error",
543-
get_error_message(code));
543+
player->event_sink_->Error("Player error", get_error_message(code));
544544
}
545545
}
546546

packages/video_player/tizen/src/video_player.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include <flutter/plugin_registrar.h>
77
#include <player.h>
88

9+
#include <functional>
10+
#include <memory>
911
#include <mutex>
1012
#include <string>
1113

packages/video_player/tizen/src/video_player_tizen_plugin.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
#include <flutter/plugin_registrar.h>
77
#include <flutter/standard_method_codec.h>
88

9+
#include <map>
10+
#include <memory>
11+
#include <string>
12+
913
#include "flutter_texture_registrar.h"
1014
#include "log.h"
1115
#include "message.h"
@@ -102,7 +106,7 @@ TextureMessage VideoPlayerTizenPlugin::create(const CreateMessage &createMsg) {
102106
LOG_DEBUG(
103107
"[VideoPlayerTizenPlugin.create] failed to get resource path "
104108
"of package");
105-
throw VideoPlayerError("failed to get resource path", "");
109+
throw VideoPlayerError("Internal error", "Failed to get resource path.");
106110
}
107111
}
108112
LOG_DEBUG("[VideoPlayerTizenPlugin.create] uri of video player: %s",

0 commit comments

Comments
 (0)