'VIdeo streams keep on loading in flutter vlc player

I'm trying to build a video stream app that fetches the stream from an api, the problem is that the streams fetched aren't displaying instead my CircularProgressIndicator keeps on loading . I can't really figure out what is the problem . output image

Here is my code

class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);

@override
State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
Future<List<dynamic>> fetchMedia() async {
final result = await Future.wait([
  http.get(Uri.parse('https://iptv-org.github.io/api/streams.json')), // all 
  streams and details
  http.get(Uri.parse('https://iptv-org.github.io/api/channels.json')), // all 
  channels and details
 ]);

final result1 = json.decode(result[0].body) as List<dynamic>;
final result2 = json.decode(result[1].body) as List<dynamic>;
result1.addAll(result2);

return result1;
 }

String _name(dynamic media) {
return media['channel'];
}

String _location(dynamic media) {
return media['url'];
}
String _stat(dynamic media) {
return media['status'];
}

 @override
  Widget build(BuildContext context) {
  return Scaffold(
  body: Container(
    child: FutureBuilder<List<dynamic>>(
      future: fetchMedia(),
      builder: (BuildContext context, AsyncSnapshot snapshot) {
        if (snapshot.hasData) {
          return ListView.builder(
              padding: EdgeInsets.all(8),
              itemCount: 5,
              itemBuilder: (BuildContext context, int index) {
                     String status = _stat(snapshot.data[index]);
                String myUrl = _location(snapshot.data[index]);
                
                   String name =_name(snapshot.data[index]);
                   
               if ( status == 'online') {
                // ignore: unnecessary_new
                VlcPlayerController _vlcViewController =
                    new VlcPlayerController.network(
                  myUrl,
                  autoPlay:true,
                );
     
           return Card(
                  child: Column(
                    children: <Widget>[
                      InkWell(  
                   child:   ListTile(
                        title: Text(name),
                        subtitle: SizedBox(
                          height: 200,
                          width: 300,
                          child: VlcPlayer(
                            aspectRatio: 16 / 9,
                            controller: _vlcViewController,
                            placeholder:
                                Center(child: CircularProgressIndicator()),
                          ),
                        ),
                      ),)
                    ],
                  ),
                ) ;

               } else{ return Container();} });  

        } else {
          return Center(
              child: CircularProgressIndicator(
            color: Colors.orange,
          ));
        }
      },
    ),
  ),
);

Can somebody help please



Solution 1:[1]

You might not have internet permission enabled on android. To enable it locate AndroidManifest.xml file and add the following line:

<manifest xlmns:android...>
 ...
 <uses-permission android:name="android.permission.INTERNET" />
 <application ...
</manifest>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eimantas G