Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3722

Flutter youtube_player_iframe not shown on mobile

$
0
0

I 'm trying to show a youtube video inline in my flutter app using the youtube_player_iframe.The video is shown if:

  • I launch the application on Android APK
  • I launch the application from Android Studio emulator

However, a blank page is shown when:

  • I open the web.app from ios mobile
  • I open the web.app from Android mobile
  • I open the web.app from Chrome on PC

Can anyone suggest which is the problem?

I tried to use also the youtube_player_flutter but in that case the video doesn't start and is stucked at infinite looping when I open the web.app from ios/Android mobile and Chrome PC.

This is the code of the App:

class YoutubeAppDemo extends StatefulWidget {  @override  _YoutubeAppDemoState createState() => _YoutubeAppDemoState();}class _YoutubeAppDemoState extends State<YoutubeAppDemo> {  late YoutubePlayerController _controller;  @override  void initState() {    super.initState();    _controller = YoutubePlayerController(      params: const YoutubePlayerParams(        showControls: true,        mute: true,        showFullscreenButton: false,        loop: false,      ),    );    _controller.loadVideoById(      videoId: 'egMWlD3fLJ8',      startSeconds: 0,    );  }  @override  Widget build(BuildContext context) {    /*return YoutubePlayerScaffold(      controller: _controller,      builder: (context, player) {*/        return Scaffold(          appBar: AppBar(            title: const Text('Youtube Player IFrame Demo'),          ),          body: ListView(            children: [            YoutubePlayer(controller: _controller),            const Controls(),            ],          )        );     // },    //);  }  @override  void dispose() {    _controller.close();    super.dispose();  }}///class Controls extends StatelessWidget {  ///  const Controls();  @override  Widget build(BuildContext context) {    return Padding(      padding: const EdgeInsets.all(16),      child: Column(        crossAxisAlignment: CrossAxisAlignment.start,        children: [          Text("MetaDataSection"),          _space,          Text("SourceInputSection"),          _space,          Text("PlayPauseButtonBar"),          _space,          const Text("VideoPositionSeeker"),          _space,          Text("PlayerStateSection"),        ],      ),    );  }  Widget get _space => const SizedBox(height: 10);}

screen on emulator or Android APKscreen on PC web app link or accessing the web.app from ios/Android


Viewing all articles
Browse latest Browse all 3722

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>