dart 我使用flutter_vlc_player包进行Rtsp相机预览在Android中运行良好,但在macos中出错,这个包支持macos吗?

t9aqgxwy  于 2023-06-19  发布在  Flutter
关注(0)|答案(1)|浏览(142)

这是我的准则

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与此软件包。告诉我哪个软件包rtsp支持macos和windows??

相关问题