Skip to content

Recent Posts

  • A Comparison In between The Java IDEs: Netbeans and Eclipse
  • Plane Constructions Structure
  • Why Ecommerce Web page Structure Providers Is Important for On the web Enterprises
  • Social Media Marketing and advertising is Attracting Offline Desire
  • Some Distinctions Between Android And J2ME

Most Used Categories

  • Technology (147)
  • Gadget (145)
  • Internet Marketing (143)
  • Android (141)
  • iOS (136)
  • Tec Business (97)
  • Web Design (44)
  • Apps (3)
  • Business (2)
  • Automotive (2)
Skip to content
cdr-inc

cdr-inc

Subscribe
  • Home
  • Technology
  • Internet Marketing
  • Web Design
  • Android
  • iOS
  • Gadget
    • Apps
    • Mobile
  • About Us
    • Advertise Here
    • Contact Us
    • Privacy Policy
    • Sitemap
  • Home
  • Flutter Video Participant Widget Integration

Flutter Video Participant Widget Integration

Jack SparrowDecember 5, 2022

Table of Contents

  • Flutter Video Participant :
  • pubspec.yaml :
  • VideoPlayerWidget.dart :
  • primary.dart :

Flutter Video Participant :

On this weblog we’re going to be told one of the simplest ways to put into effect video participant to your flutter app. Making a customized widget elegance as including required options.

Flutter video avid gamers are useful to show / exhibit your product a lot more successfully in order that customers can perceive the services and products presented via the app.

Including video in splash display, dashboard or intro monitors makes it a lot horny to the person interface and gives a wealthy glance as smartly.

Now a days there may be availability of top pace web which reinforces the app utilization via streaming top of the range movies on mobiles and in addition gadgets are getting up to date.

For extra attention-grabbing flutter tutorials discuss with us and get detailed rationalization.

 

 

pubspec.yaml :

Upload the chewie, video_player dependencies in your pubspec record such that we will combine flutter video participant the use of them. Additionally give you the newest variations of the library to keep away from any problems.

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2
  chewie: ^1.3.6
  video_player: 2.4.8

 

 

VideoPlayerWidget.dart :

On this weblog we’re going to create a flutter video participant widget elegance such that we will simply combine it any the place in our app simply.

We want to claim variables required for flutter video participant

ultimate VideoPlayerController videoPlayerController;
ultimate bool looping;
ultimate bool autoplay;

 

And initialize those with the assistance of constructor this elegance can be utilized to play movies in numerous monitors.

VideoPlayerWidget(
    this.videoPlayerController,
    this.looping,
    this.autoplay
    );

 

Now claim Chewie controller

past due ChewieController chewieController;

 

Claim the variables within the chewieController the use of init state.Right here we will specify necessities like aspectRatio, autoInitialize, autoPlay, looping and in addition error handler such that we will deal with undesirable mistakes.

ChewieController(
  videoPlayerController: widget.videoPlayerController,
  aspectRatio: 4/9,
  autoInitialize: true,
  autoPlay: widget.autoplay,
  looping: widget.looping,

  errorBuilder: (context, errorMessage){
  go back Heart(
    kid: Textual content("One thing went flawed"),
  );

 

And in addition upload a dispose manner

@override
void dispose() {
  // TODO: put into effect dispose
  tremendous.dispose();
  chewieController.dispose();
}

 

In spite of everything claim the chewie controller in order that we will watch video

Container(
  kid: Chewie(
    controller: chewieController,
  ),
);

 

Entire code for flutter video participant widget elegance.

 

import 'bundle:chewie/chewie.dart';
import 'bundle:flutter/subject matter.dart';
import 'bundle:video_player/video_player.dart';

elegance VideoPlayerWidget extends StatefulWidget {

  ultimate VideoPlayerController videoPlayerController;
  ultimate bool looping;
  ultimate bool autoplay;

  VideoPlayerWidget(
      this.videoPlayerController,
      this.looping,
      this.autoplay
      );

  @override
  State<VideoPlayerWidget> createState() => _VideoPlayerWidgetState();
}

elegance _VideoPlayerWidgetState extends State<VideoPlayerWidget> {

  past due ChewieController chewieController;

  @override
  void initState() {
    // TODO: put into effect initState
    tremendous.initState();
    chewieController = ChewieController(videoPlayerController: widget.videoPlayerController,
      aspectRatio: 4/9,
      autoInitialize: true,
      autoPlay: widget.autoplay,
      looping: widget.looping,

      errorBuilder: (context, errorMessage){
      go back Heart(
        kid: Textual content("One thing went flawed"),
      );
      }
    );
  }

  @override
  void dispose() {
    // TODO: put into effect dispose
    tremendous.dispose();
    chewieController.dispose();
  }

  @override
  Widget construct(BuildContext context) {
    go back Container(
      kid: Chewie(
        controller: chewieController,
      ),
    );
  }
}

 

primary.dart :

We’re applying the above created video participant widget on this display.

import 'bundle:flutter/subject matter.dart';
import 'VideoPlayerWidget.dart';
import 'bundle:video_player/video_player.dart';

void primary(){
  runApp(MyApp());
}

elegance MyApp extends StatefulWidget {
  const MyApp({Key? key}) : tremendous(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

elegance _MyAppState extends State<MyApp> {
  @override
  Widget construct(BuildContext context) {
    go back MaterialApp(
      house: Scaffold(
        appBar: AppBar(
          identify: Textual content("Video Participant"),
        ),
        frame: Container(
          kid: VideoPlayerWidget(
            VideoPlayerController.asset('asset/video.mp4'),
            true,
            true
          ),
        ),
      ),
    );
  }
}



 

If in case you have any question’s on this educational on flutter video participant do tell us within the remark segment beneath.In case you like this educational do like and percentage us for extra attention-grabbing updates.

Related Posts:

  • Flutter dio add a picture or report
  • Flutter dio add a picture or report
  • Development Video games in Flutter with Flame: Getting Began
  • What's the Very best Platform for Instrument Building
  • Price and Options You Want to Know For Growing Android Myth…
  • PlayStation Portable - A Handheld Gaming Console and Its…
Flutter, Integration, Player, Video, widget

Post navigation

Previous: Designing To Take away Helps | Hackaday
Next: Server-Aspect Check in with Apple

Related Posts

Plane Constructions Structure

September 24, 2023April 11, 2023 Jack Sparrow

Some Distinctions Between Android And J2ME

September 22, 2023April 11, 2023 Jack Sparrow

Top Patterns of and Supplies for Padlock Shackles

September 14, 2023April 11, 2023 Jack Sparrow

Recent Posts

  • A Comparison In between The Java IDEs: Netbeans and Eclipse
  • Plane Constructions Structure
  • Why Ecommerce Web page Structure Providers Is Important for On the web Enterprises
  • Social Media Marketing and advertising is Attracting Offline Desire
  • Some Distinctions Between Android And J2ME

Recent Comments

No comments to show.

Archives

  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
September 2023
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  
« Aug    

BL

Traveling everywhere
Copyright All Rights Reserved | Theme: BlockWP by Candid Themes.
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT