Comments (6)
Here is example code under my assumption:
- call
await ensurePlayer()
before any method likeplay
,open
,stop
,pause
.... _Player
is deprecated and use a factory to reuse instance. Another side, it improves the null-safety check.
import 'dart:async';
import 'package:flutter/services.dart';
late MethodChannel channel;
class Player {
int id;
static Map<int, Player> _players = {};
Completer<void>? _completer;
factory Player({required int id}) {
if (_players.containsKey(id)) return _players[id]!;
final Player _player = Player._(id);
_players[id] = _player;
return _player;
}
Player._(this.id) {
ensurePlayer();
}
Future<void> ensurePlayer() async {
if (_completer != null) return _completer!.future;
_completer = Completer();
await channel.invokeMethod(
'create',
{
'id': id,
},
);
_completer!.complete();
}
Future<void> play() async {
await ensurePlayer();
await channel.invokeMethod(
'play',
{
'id': this.id,
},
);
}
}
from dart_vlc.
Hi there @narumishi !
Umm I was using a synchronous constructor in the previous project, as you might recall. But that used to cause bit of problems, as people used to call any method directly after creating of object in the same method & then used to report me bugs, so I made it completely safe this time 😟.
I feel this project would be much stable for you compared to older one.
I'll look forward to get what you said.
Thanks.
from dart_vlc.
Thanks.
Seeing this code reminds me that I haven't even migrated to null safety yet.
from dart_vlc.
Just compiled the windows version... I have never thought libvlc
will generate 120MB files in plugins
folder which is still 60MB large after zipped.
Is there any options to decrease plugins
folder size while most of them of useless if I just want to play mp3/wav audios?
from dart_vlc.
Just compiled the windows version... I have never thought libvlc will generate 120MB files in plugins folder which is still 60MB large after zipped.
This project does not compile libVLC itself, but fetches shared libraries & headers etc. directly from VideoLAN severs, if I could compile libVLC myself, then it could be possible to select the plugin that one wants.
Is there any options to decrease plugins folder size while most of them of useless if I just want to play mp3/wav audios
All I can say right now, is "trial and error", as far as I'm aware there are many many plugins for video decompression, even Qt window etc. that you might won't need. So, you can just try and delete the folders/DLLs that you find unnecessary. (I can guarantee not much of the DLLs depend on each other inside the plugins
folder)
This is where miniaudio version was lightweight (a lot) than this.
from dart_vlc.
Okay finally.
from dart_vlc.
Related Issues (20)
- Same video not playing second time.
- 'filesystem' file not found HOT 1
- playOrPause method not working HOT 1
- how to get the resource duration
- Trying to create a realse app in windows using Inno, HOT 1
- when the music playback is completed?
- app rash du to Libaccess_output_srt_plugin.dll
- HEVC Video
- main vout display error: Failed to set on top
- Recording on Windows not able to play
- setVolume not working at all
- windows 7 support
- player.dispose() crashes or freezes my app
- package:media_kit
- DirectShor parameter args is not working
- MacOs dart_vlc not such file HOT 4
- Window Problems encountered playing locally encrypted m3u8 files
- Play a movie on Windows 7 with sound and no photos What's the problem?
- Open media and get its duration without starting playback?
- 支持macOS吗
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 dart_vlc.