-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
VideoPlayer is not working (Gstreamer). #312
Comments
The default video player platform implementation was removed a while ago, I'm working on a fix. For now you'll have to explicitly add a dependency on |
Hi ardera, first of all thank you for this awesome project! |
@edgardiano did you find a solution? |
@Binozo @Vallevard |
@ardera I tried using the package and your suggested branch but I got the following error:
|
@Binozo mh that's interesting. is that the complete log? Does it terminate immediately or does it run for some time and then quit? It sounds like a graphics memory leak but if that was the case, I'd expect it to fail a bit later, not when mmap-ing the first bo. I'll try using HDMI too, I've only tried using DSI. Though not sure that makes a difference. Can you send me the following infos:
|
@ardera It runs and terminates instantly I think flutter-pi doesn't even start to run the flutter app but anyway here is my code: main.dartimport 'package:flutterpi_gstreamer_video_player/flutterpi_gstreamer_video_player.dart';
import 'package:video_player/video_player.dart';
import 'package:youtube_explode_dart/youtube_explode_dart.dart';
import 'package:flutter/material.dart';
void main() {
print("Registering.....");
FlutterpiVideoPlayer.registerWith();
runApp(const MyApp());
print("hier");
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
String _stream = "";
late VideoPlayerController _controller;
final url = "https://rr4---sn-h0jeenld.googlevideo.com/videoplayback?expire=1675469345&ei=wU3dY-TqJIKR7QSY54b4Ag&ip=91.89.115.158&id=o-ALKl6ig8FMPhZBjNicz05SyGPrFEHcM9-VXu-8ZSVzgC&itag=22&source=youtube&requiressl=yes&mh=OK&mm=31%2C26&mn=sn-h0jeenld%2Csn-4g5ednkl&ms=au%2Conr&mv=m&mvi=4&pl=22&initcwndbps=1875000&vprv=1&mime=video%2Fmp4&cnr=14&ratebypass=yes&dur=1188.954&lmt=1627902618655246&mt=1675447049&fvip=3&fexp=24007246&c=ANDROID&txp=5535432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Ccnr%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRgIhAKP_JtzNRrYKXdBcxCUMVx8w7UGqHjm0CeK9oUIpp31BAiEA0mGTgT72km8KJjFQHEGNcbBG6XTmtEljCDSi6LhTNYo%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgfpZFBscIwfZlUMEZmfLJ_2Rx7m8pSaMb9aFuhJVqBU4CIQD8ONs7H_EsTk-GAr48yjw6vMP6RKWKfqvnGvMUOoHVqw%3D%3D";
void _incrementCounter() async {
var yt = YoutubeExplode();
var manifest = await yt.videos.streamsClient.getManifest('Dpp1sIL1m5Q');
print(manifest.muxed.withHighestBitrate().url);
_stream = manifest.muxed.withHighestBitrate().url.toString();
}
@override
void initState() {
super.initState();
_controller = VideoPlayerController.network(
url)
..initialize().then((_) {
// Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
setState(() {
_controller.play();
});
});
_incrementCounter();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Video Demo',
home: Scaffold(
body: Center(
child: _controller.value.isInitialized
? AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: VideoPlayer(_controller),
)
: Container(),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
setState(() {
_controller.value.isPlaying
? _controller.pause()
: _controller.play();
});
},
child: Icon(
_controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
),
),
),
);
}
@override
void dispose() {
super.dispose();
_controller.dispose();
}
}
And my dependencies: video_player: ^2.5.2
youtube_explode_dart: ^1.12.3
flutterpi_gstreamer_video_player: ^0.1.0 dmesg.log
|
@Binozo Indeed, seems like the first graphics operation it tries immediately fails. I'll try with my Pi 3, the GPU there is the same as on Pi Zero 2. |
@Binozo Can you try again with with |
@ardera you fixed that error yay😄 But sadly I get another error while starting the flutter app: Logs
Did I implemented your flutter gstreamer package wrong or what do you think could cause that error? |
@Binozo You need to call |
@ardera yeah I think I am already doing it 😅 void main() {
print("Registering.....");
FlutterpiVideoPlayer.registerWith();
runApp(const MyApp());
print("hier");
} |
@Binozo I'll try reproducing it, though the example app I wrote works for me 😅 Very weird error. |
Hello, OS: Raspian OS 64bits I use flutter for signage with raspberry and I have to loop one video or if there are multiple videos reproduce each video and start again when the last video end. If I find something, I'll back to you. |
Hello, Does anyone has problem with the addListener from VideoPlayerController, before I update it was working but now it does not and there is no error showing up. |
Hello everyone, Any progress on this? @ardera Do you plan to bring it to master any time soon? Best regards, |
Hello @ardera , I have tried what seems like everythin and my latest attempt is using the gstreamer-player-from-pipeline branch and The app loads and i see the tabs "Example Video" and "Camera" but the main screen area is grey background with controls and then turns white. No video. (Also no mouse cursor) Is it possible to record a youtube video or something of how to get this working as of May 11 2023? This could save a lot of time and head banging. I've gone through the issues and tried what seems like everything. Any help greatly appreciated. Thanks! here's my output:
|
I got it working on my RPi 2. Decided to start fresh and give the RPi2 a shot and it works! I cloned flutter-pwitched to the and did: git checkout remotes/origin/feature/gstreamer-player-from-pipeline i am using the example app from the flutterpi_gstreamer_video_player 0.1.0+1 package it seems pretty solid! i gotta figure out how to get audio working now. thank you! |
@jtkeyva The above error message sounds like the gstreamer player isn't built into flutter-pi, or maybe you're not using the Audio should be working by default, it works for me at least |
yes thank you, i was not using the feature/gstreamer-player-from-pipeline I got video_player working :) perhaps i have some tweaking to do on the pi? my image/video quality is pretty poor (pixelated and color banding) and i have no sound. perhaps i need to set the color depth to something higher? are you getting sound via HDMI? did you do any optimizations or bootconfig.txt stuff? thanks! |
@jtkeyva What video are you playing back? The video player does not change resolution or color depth in any way, it just uses whatever the source provides it with. Good point, I haven't tried if HDMI sound works yet. I've tried AUX in the past and that worked |
Tried the branch Using Raspberry Pi 4 with 4GB RAM. Example app using the bee.mp4 (https://github.com/ardera/flutter-pi/assets/1443449/c7a5ebed-75c4-4943-934b-87c0e9d34d62):
|
Video ceases to play after being in a loop for a while:
Edit: here are some logs, it seems like the issue here is that QoS happens when attempting to seek after the stream has ended:
|
@ardera I tried the bee video and several others, no sound working via HDMI. In the past I as able to modify config.txt and set the pi's color depth, resolution etc. in raspbian. is this still a thing with the newer raspberry pi os? i notice my images have banding when displayed with flutter. i particularly notice a subpar quality when connected to my tv. btw: i'm on raspberry pi 2b. in my previous setup i was using omx player along with pygame and it worked and looked good but i would way rather use flutter if i can get the same video playback quality with sound and high resolution full color image rendering quality. |
Hi @ardera, player works fine, but status is not updated (videoPlayerController.value.position is allways 0 & videoPlayerController.value.isPlaying does not change to false when video ends). Also no callback to eventListener when playing stops. |
@jvictorsoto what pi hardware and OS are you running? you getting sound? is the video quality crisp? |
@ardera its a custom board running rpi CM4 with 2560x1440 screen, quality is good (i'm using h264 main profile 10mbps), no sound in the board and no sound in the video files so I can not answer about the sound quality. I'm facing another issue now, after instantiating and disposing two players, the third and adobe doesn't work. There is something else to dispose a player than calling Also killing the app and relaunching it doesn't fixes it, it needs full OS reboot, trace when retrying after killing the app:
EDIT: Switched GPU memory from 64mbs to 128mbs and seems like it works fine now (ran a test 50 players creation / destruction without issues) so probably is related to my higher resolution (or maybe there is a small leak somewhere) EDIT2: After longer tests creating and destroying player it stops working and this error msg appear when trying to create a player:
Restarting the app solves it, I'm only calling |
fixed by #323 |
First of all, thanks for creating flutter-pi, this is such a great project!
I am having some issues after trying to run an application with the video_player package, exactly the one recommended in the example part of Readme (https://pub.dev/packages/video_player#example). Please fin the details below:
-flutter_assets bundle generated in Ubuntu 18.04 machine (all process)
-video_player: 2.5.1 (and with some older versions too like 2.4.5)
-Device: STM32MP157F-EV1 (32 bits MPU)
-Flutter: 3.3.10
-flutter-pi: Latest version available in Master
-engine-binaries: Latest version available in your repo.
Command:
./flutter-pi -r 270 --release /usr/local/flutter331/flutter_assets/
Output:
I have also tried VideoPlayerController.asset instead of .network, but issue persists.
In addition, during flutter-pi building, after doing make command, different errors were displayed:
[ 4%] Building C object CMakeFiles/flutter-pi.dir/src/flutter-pi.c.o In file included from /usr/local/flutter331/flutter-pi/src/flutter-pi.c:47: /usr/local/flutter331/flutter-pi/include/flutter-pi.h:57:2: error: expected specifier-qualifier-list before 'FlutterEngineResult' 57 | FlutterEngineResult (*FlutterEngineCreateAOTData)(const FlutterEngineAOTDataSource* source, FlutterEngineAOTData* data_out); | ^~~~~~~~~~~~~~~~~~~ In file included from /usr/local/flutter331/flutter-pi/src/flutter-pi.c:47: /usr/local/flutter331/flutter-pi/include/flutter-pi.h:160:8: error: unknown type name 'FlutterTransformation' 160 | const FlutterTransformation t, | ^~~~~~~~~~~~~~~~~~~~~ /usr/local/flutter331/flutter-pi/include/flutter-pi.h: In function 'apply_flutter_transformation': /usr/local/flutter331/flutter-pi/include/flutter-pi.h:168:10: error: request for member 'scaleX' in something not a structure or union 168 | *px = t.scaleX*x + t.skewX*y + t.transX;
I could solve them by setting FLUTTER_EMBEDDER_HEADER (in the CMake file) to the flutter_embedder.h provided in your engine-binaries repo.
Thanks in advance!
The text was updated successfully, but these errors were encountered: