gpu_video_plugin 0.0.1 copy "gpu_video_plugin: ^0.0.1" to clipboard
gpu_video_plugin: ^0.0.1 copied to clipboard

PlatformAndroid

Flutter plugin about video.

GPU Video Plugin for Flutter #

A Flutter plugin for Android to handle filter from gallery, camera and video url.

    Android	

Support SDK 21+

Using #

import

    import 'package:gpu_video_plugin/gpu_video.dart';

Use video Device #

Get the list of videos on the device

    List<VideoItem> list = await VideoLoader.videosLoaders;

Get the list of supported filters

    List<String> listFilter = await Filters.filters;

Start processing filter video

    Filters.startCodec(videoPath, filter, isMute, isFlipHorizontal, isFlipVertical);

Play video

    VideoLoader.playMovie(videoPath);

Display video filter processing

        double valueProcessFilter = 0;
        ProcessFilter(
            onProgress: (val) {
              setState(() {
                valueProcessFilter = val;
              });
            },
            onCompleted: (val) {
              if (val == true) {
                valueProcessFilter = 0.0;
                loadListVideo();
              }
            },
            child: LinearProgressIndicator(
              value: valueProcessFilter,
              semanticsLabel: 'Linear progress indicator',
            ),
          ),

Use video Camera Device #

In order to use the camera, you must first apply for permission

    if (await Camera.checkPermissionCamera()) {
        Navigator.push(
           context,
          MaterialPageRoute(
              builder: (context) => const Cameraaaa()),
          );
       }

Camera display

    isLoadingCamera
      ? const Center(child: CircularProgressIndicator())
      : Camera(
      height: MediaQuery.of(context).size.height,
      width: MediaQuery.of(context).size.width,
      ),

Set Filter

    Camera.setFilter(nameFilter);

Change Camera

    switchCamera() async {
        setState(() {
          isLoadingCamera = true;
       });
       await Camera.switchCamera();
       setState(() {
         isLoadingCamera = false;
       });
      }

User FLASH

    Camera.flash();

ImageCapture

    Camera.imageCapture();

Record video

    if (!isRecord) {
        Camera.startRecord();
    } else {
        Camera.stopRecord();
    }
    setState(() {
       isRecord = !isRecord;
    });

Use video url #

Show video

    MovieView(url: url, height: 300),

Interactions with videos

                Expanded(
                  child: ListView.separated(
                      itemBuilder: (_, index) => InkWell(
                          onTap: () async {
                            if (await MovieView.setFilterMovie(
                                _listFilter[index])) {
                              setState(() {
                                isChangeValueFilter = true;
                              });
                            } else {
                              setState(() {
                                isChangeValueFilter = false;
                              });
                            }
                          },
                          child: Text(_listFilter[index])),
                      separatorBuilder: (_, index) => const SizedBox(
                            height: 20,
                          ),
                      itemCount: _listFilter.length)),
              Visibility(
                visible: isChangeValueFilter,
                child: Row(
                  children: [
                    const Text("Filter"),
                    const SizedBox(
                      width: 10,
                    ),
                    Expanded(
                      child: Slider(
                        max: 100,
                        value: valueFilter,
                        onChanged: (double value) {
                          setState(() {
                            valueFilter = value;
                            MovieView.changeValueFilter(valueFilter.toInt());
                          });
                        },
                      ),
                    ),
                  ],
                ),
              ),
              Row(
                children: [
                  const Text("Time"),
                  const SizedBox(
                    width: 10,
                  ),
                  Expanded(
                    child: ProcessMovieView(
                      onDuration: (dura) {
                        if (duration != dura) {
                          setState(() {
                            duration = dura;
                          });
                        }
                      },
                      onCurrentPosition: (currentPos) {
                        print("currentPosASSSS:" + currentPos.toString());
                        setState(() {
                          currentPosition = currentPos;
                        });
                      },
                      child: Slider(
                        max: duration.toDouble(),
                        value: currentPosition.toDouble(),
                        onChanged: (double value) {
                          setState(() {
                            currentPosition = value.toInt();
                            MovieView.seekToMovie(value.toInt());
                          });
                        },
                      ),
                    ),
                  ),
                ],
              ),

Play video

        ElevatedButton(
            style: ElevatedButton.styleFrom(
              primary: Colors.blue,
            ),
            onPressed: () {
              setState(() {
                if (isPlay) {
                  MovieView.pause();
                } else {
                  MovieView.play();
                }
                isPlay = !isPlay;
              });
            },
            child: Text(
              isPlay ? "Pause" : "Play",
              style: const TextStyle(
                color: Colors.white,
              ),
            ),
          ),

0
likes
100
pub points
0%
popularity

Publisher

unverified uploader

Flutter plugin about video.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSL-1.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on gpu_video_plugin