Skip to content
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] Add video_player package #48

Merged
merged 11 commits into from
Mar 31, 2021

Conversation

xiaowei-guan
Copy link
Contributor

No description provided.

@xiaowei-guan xiaowei-guan requested a review from a team March 12, 2021 07:24
Copy link
Member

@swift-kim swift-kim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only white screen could be displayed on my TV 6.0 emulator:

Screenshot from 2021-03-15 17-51-12

The integration test succeeded but there were some error messages.

VMServiceFlutterDriver: Connected to Flutter application.
I/ConsoleMessage( 9868): flutter: 00:00 +0: asset videos can be initialized
E/ConsoleMessage( 9868): Invalid read in StandardCodecByteStreamReader
E/ConsoleMessage( 9868): ../../../../flutter/shell/platform/tizen/external_texture_gl.cc: DestructionTbmSurface(131) > tbm_surface_h is NULL
I/ConsoleMessage( 9868): flutter: 00:01 +1: asset videos can be played
E/ConsoleMessage( 9868): ../../../../flutter/shell/platform/tizen/external_texture_gl.cc: DestructionTbmSurface(131) > tbm_surface_h is NULL
I/ConsoleMessage( 9868): flutter: 00:02 +2: asset videos can seek
E/ConsoleMessage( 9868): ../../../../flutter/shell/platform/tizen/external_texture_gl.cc: DestructionTbmSurface(131) > tbm_surface_h is NULL
I/ConsoleMessage( 9868): flutter: 00:02 +3: asset videos can be paused
E/ConsoleMessage( 9868): ../../../../flutter/shell/platform/tizen/external_texture_gl.cc: DestructionTbmSurface(131) > tbm_surface_h is NULL
I/ConsoleMessage( 9868): flutter: 00:04 +4: asset videos test video player view with local asset
E/ConsoleMessage( 9868): ../../../../flutter/shell/platform/tizen/external_texture_gl.cc: DestructionTbmSurface(131) > tbm_surface_h is NULL
I/ConsoleMessage( 9868): flutter: 00:05 +5: (tearDownAll)
I/ConsoleMessage( 9868): flutter: 00:05 +6: All tests passed!
Stopping application instance.

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="org.tizen.video_player_tizen_example" version="1.0.0" api-version="6.0" xmlns="http://tizen.org/ns/packages">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this plugin supported on older versions of Tizen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only support tizen 5.5 and tizen 6.0 now.

Copy link
Member

@swift-kim swift-kim Mar 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please specify it in README.md like this:

## Supported devices

This plugin supports Tizen 5.5 or later only.


environment:
sdk: ">=2.8.0<3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs update to be published on pub.dev.

Suggested change
flutter: ">=1.12.13+hotfix.5 <2.0.0"
flutter: ">=1.20.0 <2.0.0"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will modify it.

@HakkyuKim
Copy link
Contributor

HakkyuKim commented Mar 16, 2021

The following exception occurs when changing the video play speed on Tizen TV 6.0

E/ConsoleMessage( 9545): ../../../../flutter/shell/platform/tizen/flutter_tizen.cc: FlutterMarkExternalTextureFrameAvailable(204) > OnFrameAvailable fail texture_id = 1
E/ConsoleMessage( 9545): ../../../../flutter/shell/platform/tizen/flutter_tizen.cc: FlutterMarkExternalTextureFrameAvailable(204) > OnFrameAvailable fail texture_id = 1
E/ConsoleMessage( 9545): ../../../../flutter/shell/platform/tizen/flutter_tizen.cc: FlutterMarkExternalTextureFrameAvailable(204) > OnFrameAvailable fail texture_id = 1
E/ConsoleMessage( 9545): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PlatformException(PLAYER_ERROR_INVALID_OPERATION, player_set_playback_rate failed, null, null)
E/ConsoleMessage( 9545): #0      VideoPlayerApi.setPlaybackSpeed (package:video_player_platform_interface/messages.dart:294:7)
E/ConsoleMessage( 9545): <asynchronous suspension>
E/ConsoleMessage( 9545): #1      MethodChannelVideoPlayer.setPlaybackSpeed (package:video_player_platform_interface/method_channel_video_player.dart:78:17)
E/ConsoleMessage( 9545): #2      VideoPlayerController._applyPlaybackSpeed (package:video_player/video_player.dart:438:32)
E/ConsoleMessage( 9545): #3      VideoPlayerController.setPlaybackSpeed (package:video_player/video_player.dart:510:11)
E/ConsoleMessage( 9545): #4      _ControlsOverlay.build.<anonymous closure> (package:video_player_example/main.dart:311:26)
E/ConsoleMessage( 9545): #5      PopupMenuButtonState.showButtonMenu.<anonymous closure> (package:flutter/src/material/popup_menu.dart:1120:28)
E/ConsoleMessage( 9545): #6      _rootRunUnary (dart:async/zone.dart:1198:47)
E/ConsoleMessage( 9545): #7      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
E/ConsoleMessage( 9545): #8      _FutureListener.handleValue (dart:a
E/ConsoleMessage( 9545):   Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
E/ConsoleMessage( 9545): #10     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
E/ConsoleMessage( 9545): #11     Future._completeWithValue (dart:async/future_impl.dart:529:5)
E/ConsoleMessage( 9545): #12     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
E/ConsoleMessage( 9545): #13     _rootRun (dart:async/zone.dart:1190:13)
E/ConsoleMessage( 9545): #14     _CustomZone.run (dart:async/zone.dart:1093:19)
E/ConsoleMessage( 9545): #15     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
E/ConsoleMessage( 9545): #16     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
E/ConsoleMessage( 9545): #17     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/ConsoleMessage( 9545): #18     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)

@wanchao-xu
Copy link
Contributor

wanchao-xu commented Mar 18, 2021

Video player plugin can't be run on TV emulator, the error is caused by the emulator.
Please test the video player on mobile/wearable emulator or the real TV deice, such as NikeM.

This problem is reported before.
https://github.sec.samsung.net/f-project/plugins/pull/26

@swift-kim
Copy link
Member

If a plugin cannot be supported on a particular platform, the reason should be clearly stated. Merging a PR into the master branch means that it's going for an official release on pub.dev.

@xuelian-bai
Copy link

If a plugin cannot be supported on a particular platform, the reason should be clearly stated. Merging a PR into the master branch means that it's going for an official release on pub.dev.

We will check with both emulator team and MM player team

@xuelian-bai
Copy link

We checked with both emulator team and MM player team, they don't know how to solve it:

  1. tbm surface is NULL, and some mm player API will return error, but mm player team said they use the same lib on both TV target and TV emulator.
  2. TV emulator team only test test cases of web apps since only part of emulator platform is the same as platform of real target, they even don't support for non-web app.

So, right now, we can't support tv emulator, we will send this bug to them officially.

@xuelian-bai
Copy link

The analysis of the issue that video can't be played on TV emulator:

  1. Software codec export NV12 format images.
  2. libtbm can support NV12 format, but libtbm-emulator didn't support NV12,
03-23 14:17:08.060+0900 E/TBM     (P 2569, T 4362): [  211.065075][4362][tbm_surface_internal_create_with_flags 781]*********num_planes[2]
03-23 14:17:08.060+0900 E/TBM     (P 2569, T 4362): [  211.065090][4362][_tbm_surface_internal_query_plane_data 303]*****bufmgr_get_plane_data,error[-22]
03-23 14:17:08.060+0900 W/GST_LOG (P 2569, T 4363): (_1_) 0:03:22.450856010 �[332m�[00m �[37mDEBUG  �[00m �[00m            basesink gstbasesink.c:4181:gst_base_sink_chain_unlocked:<pulsesink>�[00m rendering object 0xade25498
03-23 14:17:08.060+0900 E/TBM     (P 2569, T 4362): [  211.065102][4362][tbm_surface_internal_create_with_flags 787][0]fail to query plane data
03-23 14:17:08.060+0900 E/TBM     (P 2569, T 4362): [  211.065137][4362][tbm_surface_internal_create_with_flags 976]error: width(1280) height(720) format(TBM_FORMAT_NV12) flags(0)

I added NV12 in libtbm-emulator, tbm surface can be created successfully, but then failed in the following.

03-23 15:33:21.940+0900 D/TBM     (P 2564, T 4914): [  791.942187][4914][tbm_bufmgr_vigs_alloc_bo_with_format 470]width = 1280, height = 720, format = 3231564e, flags = 0x0 bo_idx = 0
03-23 15:33:21.940+0900 D/MM_PLAYER(P 2564, T 4914): mm_player_priv.cpp: __get_decoded_buffer_cb(13888) > [bo C] tbm_surface_internal_get_bo failed

srcn sdk developers think NV12 format may not be supported by qemu or kernel, but they are not sure about it.
3. The reason of tbm_surface_internal_get_bo failed is,

stream.bo[GST_VIDEO_COMP_U] = tbm_surface_internal_get_bo (tbm_surface, GST_VIDEO_COMP_U);
#define GST_VIDEO_COMP_Y  0
#define GST_VIDEO_COMP_U  1
#define GST_VIDEO_COMP_V  2

mmplayer think there should be two bos, one for Y, one for UV, for NV12 format, but in libtbm-emulator, things are different, it store all YUV data in one bo, so mmplayer get failed for the second bo which is not exist in libtbm-emulator.

Anyway, for now, tv emulator can't support this.

@swift-kim
Copy link
Member

Were you able to reproduce #48 (comment) and will there be any fix for it?

Please add these lines at the end of each table in README.md when the tests are all done:

# Table 1
| [**video_player_tizen**](packages/video_player) | [video_player](https://github.com/flutter/plugins/tree/master/packages/video_player) (1st-party) | [![pub package](https://img.shields.io/pub/v/video_player_tizen.svg)](https://pub.dev/packages/video_player_tizen) | No |

# Table 2
| [**video_player_tizen**](packages/video_player) | ✔️ | ✔️ | ✔️ || API limitation |

@wanchao-xu
Copy link
Contributor

About exception occurs when changing the video play speed on Tizen TV 6.0, it's the limit of TV mmplayer. player_set_playback_rate can't set rate when the play time is last 3 senconds on TV. I can set the rate successfully when start to play video.

And there is another error, mmplayer doesn't play video on a loop after set rate, I'm checking it.

@wanchao-xu
Copy link
Contributor

wanchao-xu commented Mar 26, 2021

Video player plugin has some limitations on TV.

  1. Don't change playback speed at last 3 senconds when playing video, otherwise it will be failed.
  2. The loop playback doesn't work after change play speed successfully. This is a bug of mmplayer, and it will be fixed at next release.
  3. If playing a video in a loop and change the playback speed(not 1.0) successfully, the playback speed will be recovered to 1.0 when play video again. But the plackback speed will be kept on wearable.
  4. Don't use seekTo if playback speed isn't 1.0, seekTo doesn't work after change playback speed.
  5. The seekTo has a deviation, the video has some key frames, the seekTo will set position to the key frame, for example, seek video position to 1438 millisecond, but the key frame is 3000 millisecond, so actually the position is set to 3000 millisecond.

I will add this infomation in ReadMe.

@swift-kim
Copy link
Member

swift-kim commented Mar 26, 2021

@HakkyuKim Is this error #48 (comment) by any chance related to the keyframe issue mentioned by Wanchao? Or is it a different issue?

@HakkyuKim
Copy link
Contributor

@HakkyuKim Is this error #48 (comment) by any chance related to the keyframe issue mentioned by Wanchao? Or is it a different issue?

If seekTo is changing the currently playing frame location, then no. The issue seems to be related to:

  1. Don't change playback speed at last 3 senconds when playing video, otherwise it will be failed.

Indeed the playback speed does change when I switch it immediately after the video starts, and fails when I switch it at the end of the video.

packages/video_player/CHANGELOG.md Outdated Show resolved Hide resolved
packages/video_player/pubspec.yaml Outdated Show resolved Hide resolved
@swift-kim
Copy link
Member

Will we have any fix for these messages?

E/ConsoleMessage( 9424): ../../../../flutter/shell/platform/tizen/flutter_tizen.cc: FlutterMarkExternalTextureFrameAvailable(204) > OnFrameAvailable fail texture_id = 2
E/ConsoleMessage( 9424): ../../../../flutter/shell/platform/tizen/flutter_tizen.cc: FlutterMarkExternalTextureFrameAvailable(204) > OnFrameAvailable fail texture_id = 2
E/ConsoleMessage( 9424): ../../../../flutter/shell/platform/tizen/flutter_tizen.cc: FlutterMarkExternalTextureFrameAvailable(204) > OnFrameAvailable fail texture_id = 2
E/ConsoleMessage( 9424): ../../../../flutter/shell/platform/tizen/flutter_tizen.cc: FlutterMarkExternalTextureFrameAvailable(204) > OnFrameAvailable fail texture_id = 2
E/ConsoleMessage( 9424): ../../../../flutter/shell/platform/tizen/flutter_tizen.cc: FlutterMarkExternalTextureFrameAvailable(204) > OnFrameAvailable fail texture_id = 2
E/ConsoleMessage( 9424): ../../../../flutter/shell/platform/tizen/flutter_tizen.cc: FlutterMarkExternalTextureFrameAvailable(204) > OnFrameAvailable fail texture_id = 2
E/ConsoleMessage( 9424): ../../../../flutter/shell/platform/tizen/flutter_tizen.cc: FlutterMarkExternalTextureFrameAvailable(204) > OnFrameAvailable fail texture_id = 2

This occurs on any of my devices. Hakkyu has reported the same error in the above.

@wanchao-xu
Copy link
Contributor

Will we have any fix for these messages?

E/ConsoleMessage( 9424): ../../../../flutter/shell/platform/tizen/flutter_tizen.cc: FlutterMarkExternalTextureFrameAvailable(204) > OnFrameAvailable fail texture_id = 2
E/ConsoleMessage( 9424): ../../../../flutter/shell/platform/tizen/flutter_tizen.cc: FlutterMarkExternalTextureFrameAvailable(204) > OnFrameAvailable fail texture_id = 2
E/ConsoleMessage( 9424): ../../../../flutter/shell/platform/tizen/flutter_tizen.cc: FlutterMarkExternalTextureFrameAvailable(204) > OnFrameAvailable fail texture_id = 2
E/ConsoleMessage( 9424): ../../../../flutter/shell/platform/tizen/flutter_tizen.cc: FlutterMarkExternalTextureFrameAvailable(204) > OnFrameAvailable fail texture_id = 2
E/ConsoleMessage( 9424): ../../../../flutter/shell/platform/tizen/flutter_tizen.cc: FlutterMarkExternalTextureFrameAvailable(204) > OnFrameAvailable fail texture_id = 2
E/ConsoleMessage( 9424): ../../../../flutter/shell/platform/tizen/flutter_tizen.cc: FlutterMarkExternalTextureFrameAvailable(204) > OnFrameAvailable fail texture_id = 2
E/ConsoleMessage( 9424): ../../../../flutter/shell/platform/tizen/flutter_tizen.cc: FlutterMarkExternalTextureFrameAvailable(204) > OnFrameAvailable fail texture_id = 2

This occurs on any of my devices. Hakkyu has reported the same error in the above.

It caused by frame loss when playing video, we think it has no significant effect, so we keep it now.
We also have plan to reduce frame loss, and will do it later.

@wanchao-xu wanchao-xu merged commit 8bd9f67 into flutter-tizen:master Mar 31, 2021
@swift-kim swift-kim mentioned this pull request Apr 3, 2021
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants