web_video_pick_show 0.0.2 copy "web_video_pick_show: ^0.0.2" to clipboard
web_video_pick_show: ^0.0.2 copied to clipboard

Package to pick and show video in web. To pick it uses image_picker_web under the hook.

web_video_pick_show #

This package can be used to pick and view video in web.

Warning: Works only for Web, and uses html.File a lot. #

On other platform throws compile time error if this package is used, #

will be solved in next releases. #

For picking this package uses image_picker_web internally, so for picking you can use on your own way.

For showing, you can use EasyWebVideoShowWidget() if you have picked from this package. If you have picked on your own way, you can use CustomWebVideoShowWidget().

I recommend you seeing the repository instead of the code, so that you can customize on your own way. Also because this package is on beta phase and I don't got enough time for dedication on this package, yet you can send pull request and issues are appreciated, I will try my best to work on them. Repository

You can also see example from the above repository, there is alternative_ways.dart for guys who have very old flutter version installed.

Usage #

To Pick:

   final _controller = WebVideoPickerController();
   
    await controller.pickVideo();
    
    //OR
    
    await controller.pickMultipleVideo();
    
    //Make sure to handle WebVideoPickShowException
     
    _controller.dispose();//On dispose of StatefulWidget to avoid memory leaks
     

To show picked items for user to play one out of all:

ListenableBuilder(
  listenable: controller,
  builder: (context, _) {
    final data = controller.data;
     return ... //Render the items //See examples for better examples
    }
 );
 
Example

As you can see in the image, two red box are the picked items. You can manage them by:

    controller.play(file);
    controller.remove(index);
    controller.add(file);
    controller.addMany([file1,file2]);
    controller.addRemoveManually((item)=>manage and return manually);
    controller.clear();
    controller.isVideoPlaying(fileWhichNeedToBeCheckedWhetherPlaying);
    
 

To check whether two files are equal I have added this extension on html.File:

   html.File file1;
   html.File file2;
   print("file1.uniqueValue()==file2.uniqueValue();

Playing the video

  EasyWebVideoShowWidget(
     controller: _controller,
  ),
  
  //Or if you have picked without using my package, and the file is of html.File format
   
  CustomWebVideoShowWidget(
     uniqueKey: ValueKey(someUniqueValueToDifferentiateTwoFile),
     file: fileWhichMightBePickedFromSomeOtherSource,
  ),

Error Handling

And sorry for the Oppsie! error if you catch WebVideoPickShowException.

 try {
     //Some action
    } on WebVideoPickShowException catch (e, s) {
      //Instead of e.toString() use:
      e.withoutOppsie();
      //Else your error message would be : "Oppsie! File not found!"
    } catch (e, s) {
      //Handle It
    }

Its intentional bug ;-) because it reminds of one of my friend :-)

-------------------------------------------------------

For detailed example please view examples, either from Repository

Also check for alternative way if you have old flutter version AlternativeWay Alternative way credit goes to : CreditRepo

0
likes
0
points
22
downloads

Publisher

unverified uploader

Weekly Downloads

Package to pick and show video in web. To pick it uses image_picker_web under the hook.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, image_picker_web

More

Packages that depend on web_video_pick_show