英文:
I used flutter_vlc_player package for Rtsp camera preview Running fine in Android but getting error in macos. Is support this package for macos?
问题
**这是我的代码**
```dart
import 'package:flutter/material.dart';
import 'package:flutter_vlc_player/flutter_vlc_player.dart';
class IPCameraScreen extends StatefulWidget {
final String url;
const IPCameraScreen({Key? key, required this.url}) : super(key: key);
@override
_IPCameraScreenState createState() => _IPCameraScreenState();
}
class _IPCameraScreenState extends State<IPCameraScreen> {
late VlcPlayerController _vlcController;
@override
void initState() {
super.initState();
_initializePlayer();
}
@override
void dispose() {
_vlcController.dispose();
super.dispose();
}
void _initializePlayer() {
_vlcController = VlcPlayerController.network(
// widget.url,
'rtsp://192.168.100.208:80/rtsp/streaming?channel=5&subtype=1',
hwAcc: HwAcc.full,
autoPlay: true,
options: VlcPlayerOptions(),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('IP Camera Preview'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
VlcPlayer(
controller: _vlcController,
aspectRatio: 16 / 9,
placeholder: const Center(child: CircularProgressIndicator()),
),
],
),
),
);
}
}
错误 ->> 未处理的异常: PlatformException(channel-error, 无法在通道上建立连接。, null, null)
如果 macOS 不支持 https://pub.dev/packages/flutter_vlc_player 这个包的话。
告诉我在 macOS 和 Windows 上有哪些支持 rtsp 的包?
<details>
<summary>英文:</summary>
**it's my code**
import 'package:flutter/material.dart';
import 'package:flutter_vlc_player/flutter_vlc_player.dart';
class IPCameraScreen extends StatefulWidget {
final String url;
const IPCameraScreen({Key? key, required this.url}) : super(key: key);
@override
_IPCameraScreenState createState() => _IPCameraScreenState();
}
class _IPCameraScreenState extends State<IPCameraScreen> {
late VlcPlayerController _vlcController;
@override
void initState() {
super.initState();
_initializePlayer();
}
@override
void dispose() {
_vlcController.dispose();
super.dispose();
}
void _initializePlayer() {
_vlcController = VlcPlayerController.network(
// widget.url,
'rtsp://192.168.100.208:80/rtsp/streaming?channel=5&subtype=1',
hwAcc: HwAcc.full,
autoPlay: true,
options: VlcPlayerOptions(),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('IP Camera Preview'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
VlcPlayer(
controller: _vlcController,
aspectRatio: 16 / 9,
placeholder: const Center(child: CircularProgressIndicator()),
),
],
),
),
);
}
}
Error->>
Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)
If macos not support https://pub.dev/packages/flutter_vlc_player with this package.
Tell me which package rtsp support for macos and windows??
</details>
# 答案1
**得分**: 0
只支持安卓和iOS。
<details>
<summary>英文:</summary>
**It only support on android and IOS.**
[image][1]
[1]: https://i.stack.imgur.com/fy2wX.png
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论