Flutter video background player instead of image background

691

You can use stack to have your video play in the background while in loop, while your other widget is at the top of the stack.

This person solved it please refer to his answer https://stackoverflow.com/a/57763089/8572736

Share:
691
Julien leburn
Author by

Julien leburn

Updated on December 12, 2022

Comments

  • Julien leburn
    Julien leburn over 1 year

    Here is my issue, i am trying to achieve video background player instead og my image background i tried with gif but render is just in 256 colours. thanks very much I 'have been pulling my hair to integrate with no success

    
    class Login extends StatelessWidget {
    static const your_client_id = '0000000000000000';
    final FirebaseAuth _auth = FirebaseAuth.instance;
    static const your_redirect_url =
    'https://xxxxxxx.firebaseapp.com/__/auth/handler';
    
    final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
    
    @override
    Widget build(BuildContext context) {
      return WillPopScope(
        child: Scaffold(
    
      backgroundColor: Colors.white,
      body: Container(
      constraints: BoxConstraints.expand(),
      decoration: BoxDecoration(
      image: DecorationImage(
      image: AssetImage("asset/images/bg.jpg"),
      fit: BoxFit.cover,
      )
      ),
    

    Trying to replace my container content with this code i dont know if its the right thing to do

    Container(
     width: *screen width*,
     height: *screen height*,
     child: Stack(
       children: <Widget>[
         Center(
           child: Transform.scale(
             scale: 3.9, //change this number as needed
             AspectRatio(
               aspectRatio: _controller.value.aspectRatio,
               child: VideoPlayer(_controller),
             ),
           ),
         ),
    
  • Julien leburn
    Julien leburn about 3 years
    I would i integrate in my code above? the rest of the code is a login process, thanks
  • Musa Jahun
    Musa Jahun about 3 years
    sorry don't understand your question, can you explain more?
  • Julien leburn
    Julien leburn about 3 years
    I mean in my container i would like to put the videoplayer but its not working got errors
  • Musa Jahun
    Musa Jahun about 3 years
    can you share the errors? so I can help you debug the problem