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?

huangapple go评论65阅读模式
英文:

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&#39;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-&gt;&gt;
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>



huangapple
  • 本文由 发表于 2023年6月15日 14:27:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/76479688.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定