I'm testing a dependency of flutter and having these issues while trying to show video streaming using ngrok, these are the issues i have:
E/VLC (15337): [00000071a614bc90/3c35] libvlc stream: HTTP connection failure
E/VLC (15337): [00000071a614bc90/3c35] libvlc stream: connection failed: Network is unreachable
E/VLC (15337): [00000071a614bc90/3c35] libvlc stream: cannot connect to ae872c2bd308.ngrok.io:80
and this is code I'm using:
import 'package:flutter/material.dart';
import 'package:flutter_vlc_player/flutter_vlc_player.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
VlcPlayerController _videoPlayerController;
@override
void initState() {
super.initState();
_videoPlayerController = VlcPlayerController.network(
'http://ae872c2bd308.ngrok.io/stream',
hwAcc: HwAcc.FULL,
autoPlay: false,
options: VlcPlayerOptions(),
);
}
@override
void dispose() async {
super.dispose();
await _videoPlayerController.stopRendererScanning();
await _videoPlayerController.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Center(
child: VlcPlayer(
controller: _videoPlayerController,
aspectRatio: 16 / 9,
placeholder: Center(child: CircularProgressIndicator()),
),
),
);
}
}
Any idea of what could be the problem?
I tested the transmission using VLC player and it is possible to make it work.
Add autoPlay: true
to the controller so it becomes
_videoPlayerController = VlcPlayerController.network(
'http://ae872c2bd308.ngrok.io/stream',
hwAcc: HwAcc.FULL,
autoPlay: true,
options: VlcPlayerOptions(),
);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.