Comments (37)
Thanks for the clarification. The example application also seems to crash for some reason (it didn't earlier) when playing two videos simultaneously. I will fix issues like this & it is the primary reason I haven't published the plugin yet. I will hold accountability for stability. I need some time.
I'm actually busy with my semester examinations till the end of this month.
I will make further advancements & implementation(s) for other platforms after returning.
from media-kit.
It's invalid memory access or access violation as I said. I'm not super sure about what could be causing it.
I will try fixing tomorrow & begin working on linux implementation.
from media-kit.
Remove any dispose calls.
from media-kit.
Unfortunately it still does. I have made a widget with the media_kit included. I call this widget multiple times.
from media-kit.
A better clarification will be provided with the stacktrace of the crash. Use Visual Studio to do it (for debug build).
from media-kit.
Thank you! Much appreciated.
from media-kit.
Ping @Quackdoc:
For me, this glFinish
is crashing with invalid memory access. The invalid memory access is taking place within the ANGLE DLL. I'm not sure about this one (at the moment), maybe this could be due to wrong usage or syncing issue?
I attempted to use single mutex for all VideoOutput
s, the crash still takes place when playing multiple videos.
Try using the last section of the example application, where 2 videos can be played side by side.
EDIT:
from media-kit.
hmm, im getting sigterm even without that glfinish.
EDIT1; yeah even without any of the glfinishes, if I start one video, then swap between the other ones with a somewhat moderate speed, the program just closes. vscode isnt providing anything useful, maybe I have it misconfigured
EDIT2;
Its certainly a GL issue since forcing S/W rendering doesn't have any of the issues at all.
from media-kit.
A workaround is to pass fixed size from VideoController.create
for now.
from media-kit.
Hi @GideonKock,
I've made a fix. Please try it out (confirmation is needed to keep the track), it shouldn't crash anymore.
NOTE: Flutter 3.7.x+ is needed from now on (beta or master channel at the time). This was partially due to bugs in Flutter itself.
You can download the test application for a quick look: https://github.com/alexmercerind/media_kit/suites/10371871389/artifacts/511589023 . Select last option for playing 2 videos at once. AFAIK crash triggered when size of video changed or played for the first time. Your feedback after compiling/running your own application is also welcomed. It should work fine too.
from media-kit.
@GideonKock any feedback?
from media-kit.
I'm still testing, but after upgrading the package, my own application still crashes with the same error, with and without dispose calls. I will do some tests and provide more information.
from media-kit.
Make sure that the package is actually updated. Git dependencies in pubspec.yaml
generally don't sync.
You should specify ref: 36b0681c61fcfe7283b07d7d4b67c8554e080e7b
(for both packages) as-well. Then, flutter pub get.
dependencies:
media_kit:
git: https://github.com/alexmercerind/media_kit.git
path: media_kit
ref: 36b0681c61fcfe7283b07d7d4b67c8554e080e7b
media_kit_core_video:
git: https://github.com/alexmercerind/media_kit.git
path: media_kit_core_video
ref: 36b0681c61fcfe7283b07d7d4b67c8554e080e7b
from media-kit.
And be on master
/beta
channel.
from media-kit.
I'm getting the following error:
from media-kit.
And be on
master
/beta
channel.
^^
from media-kit.
Sorry, I was running on the stable channel. But after a flutter clean and pub get I get the following message:
from media-kit.
Sorry, I was running on the stable channel. But after a flutter clean and pub get I get the following message:
Please update ref to latest.
The links to one of dependencies was changed. Sorry won't happen again.
from media-kit.
It's working :). Only with a material app. Unfortunately I use Fluent_ui and I get errors related to this packege when I'm on the master channel. Any suggestions?
from media-kit.
Unfortunately the issue still occur. I have made an example. See the code below. The error only accurs with a valid url.
The error occurs after switching tabs a couple of times.
from media-kit.
import 'package:flutter/material.dart';
import 'package:media_kit/media_kit.dart';
import 'package:media_kit_video/media_kit_video.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
int currentPageIndex = 0;
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue, scaffoldBackgroundColor: Colors.blue),
home: DefaultTabController(
length: 2,
child: Scaffold(
appBar: const TabBar(
tabs: [
Tab(icon: Icon(Icons.directions_car)),
Tab(icon: Icon(Icons.directions_transit)),
],
),
body: TabBarView(
children: [
Wrap(
children: [
for (int i = 0; i < 1; i++) ...[
SizedBox(height: 500, width: 500, child: MyScreen())
]
],
),
Wrap(
children: [
for (int i = 0; i < 2; i++) ...[
SizedBox(height: 500, width: 500, child: MyScreen())
]
],
),
],
),
),
));
}
}
class MyScreen extends StatefulWidget {
const MyScreen({Key? key}) : super(key: key);
@override
State<MyScreen> createState() => _MyScreenState();
}
class _MyScreenState extends State<MyScreen> {
final Player player = Player();
VideoController? controller;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
controller = await VideoController.create(
player.handle,
);
player.open(Playlist(
[
Media(
'https://....:[email protected]:55756/Acs/Streaming/Video/Live/Mp4/?camera=27074_196f745a-87e5-4325-ba5b-cda2d12026e7&quality=medium&audio=0'),
],
));
setState(() {});
});
}
@override
void dispose() {
Future.microtask(() async {
// Release allocated resources back to the system.
await controller?.dispose();
await player.dispose();
});
super.dispose();
}
@override
Widget build(BuildContext context) {
return Video(
filterQuality: FilterQuality.high,
controller: controller,
);
}
}
from media-kit.
you are disposing the controller
from media-kit.
Can't reproduce. Present more details, what is the extent & what is the cause.
Use Visual Studio to generate stack-trace.
from media-kit.
Yes, this was mentioned in the example on the mainpage. So I only have to dispose the player?
from media-kit.
Yes, this was mentioned in the example on the mainpage. So I only have to dispose the player?
What makes you so sure that your async
calls to create/dispose don't cause some conflict when changing tabs very-very quickly i.e. dispose
being called before WidgetsBinding.instance.addPostFrameCallback
completes? The test application is playing/creating/disposing 4 videos simultaneously without any races or access violations etc.
C++ isn't for kids. It doesn't kindly inform you about invalid memory accesses with a nice message.
A debugger works here e.g. devenv
or Visual Studio.
https://gist.github.com/loic-sharma/248f28b3ba4664dde08da68f46b312bd
from media-kit.
Without disposing the controller the error no longer appears.
With disposing the controller, the error appears when choosing the other tab and then back. Also when switch tabs slowly.
I've used the debugger in Visual Studio as you mentioned. I hope this is the information you need:
from media-kit.
@GideonKock, try out the latest changes on 5bf3a17.
Specify ref
as 5bf3a17cdb8d68cc5b43141d791b27cac837a4e9
in your pubspec.yaml for both packages.
from media-kit.
There was an issue within my implementation of releasing EGL resources inside ANGLESurfaceManager destructor.
Now calling dispose won't crash (and it's important to release resources, please don't remove it).
Still, I'm facing few very rare crashes within libGLESv2.dll through libmpv-2.dll when dragging through tabs using my track-pad in a fast manner & there's very little that can be done. Let's see what can I do.
EDIT: Only happening when dispose
is present.
A GOOD IDEA WILL BE TO manage your VideoController
& Player
efficiently instead of depending on initState
etc.
Example:
Create one Player
& VideoController
outside the tab viewer & use it for displaying video in every tab. It will be more performant & avoid initialization delays as well.
from media-kit.
I'd appreciate response though. Any improvements?
from media-kit.
GOOD NEWS!
I could fix that as well. No more crashes!
Checkout to 5bf3a17 & specify ref as 5bf3a17cdb8d68cc5b43141d791b27cac837a4e9
in your pubspec.yaml.
Also, I added a new screen to test application for simulating this scenario & deal with future implementations:
Whole day wasted! 🥳🥳🥳
from media-kit.
Nice! Sorry, but I’m not able tot test it today. Will do it tomorrow. But it seems very good. Much appriciated!
from media-kit.
Any feedback?
from media-kit.
In my own application it still crashes. Only difference compared to the example application is that I use multiple streams at one tab. Will test it tomorrow in the example application.
from media-kit.
Best practice will be to maintain the Player
& VideoController
instances outside of Tab
s & only pass their reference into the widgets. It will give you not only finer control over lifecycle but improve performance as you can possibly use already created Player
s within multiple tabs (as previous one automatically gets hidden).
from media-kit.
Thanks, will try to implement. Multiple video's in a tab in your test application works without errors.
from media-kit.
I tried running your exact same example above & I see literally zero crashes, it's so stable.
from media-kit.
FYI stability has been further improved for Windows in latest media_kit: ^0.0.2 & media_kit_video: ^0.0.2 (upgrade both).
from media-kit.
Related Issues (20)
- Playing a local video file instead of web address HOT 3
- 我不明白,为什么video_player_media_kit的sample使用video_player插件播放视频?
- Application freezed sometimes when playing at rate 2 speed.
- How to show and hide controls programmatically?
- how to play ftp link video HOT 2
- Subtitle names are not available
- [Linux] GPU Acceleration HOT 6
- Use interactive viewer HOT 1
- In Flutter web, google chrome (not mobile's browser, desktop browser) does not play video HOT 5
- [HLS] Seek does not work on macos & android HOT 7
- Audio does not play again after setting new Audio track after calling player.stop() HOT 12
- add PlayingState ? HOT 1
- [Crash][macOS] Abort Signal on macOS HOT 5
- Non-C locale detected error HOT 1
- [Improvement advice] Performance update
- Android background playback.
- The vertical screen is full screen, and the subtitles are in the wrong position.
- [android] how to enable libass on Android? HOT 14
- No video, only sound on Android
- [Android] Video is completely black on real device HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from media-kit.