Giter Site home page Giter Site logo

newtadev / pod_player Goto Github PK

View Code? Open in Web Editor NEW
88.0 5.0 140.0 20.53 MB

Video player for flutter web & mobile devices, Play video from youtube or vimeo or network in flutter using pod player

Home Page: https://pub.dev/packages/pod_player

License: MIT License

Kotlin 0.06% Swift 0.76% Objective-C 0.02% Dart 83.03% HTML 1.94% Ruby 1.33% CMake 4.07% C++ 8.32% C 0.36% Shell 0.11%
flutter flutter-web video-player vimeo-player youtube-player flutter-web-video-player vimeo-player-flutter youtube-player-flutter hacktoberfest

pod_player's People

Contributors

allou-deyforyou avatar dotkebi avatar emersonsiega avatar jeferson505 avatar newtadev avatar newtaold avatar onlycan17 avatar oplik0 avatar rafaelmeteoro avatar sybrands-place avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pod_player's Issues

Add option for pinch to zoom

When we view a video with 16:9 on 18:9 phone we often see the bezels. With youtube you can pinch to zoom to fit the video to width.

I am asking you to either replicate the same or add some way to change the BoxFit like we change it for image.

Like:

controller.setFit(BoxFit.fitWidth)

Playing video in list

Hi, thank you for developing that awesome package!

Currently, I'm using it to show videos in list. I would like to achieve the similar effect like Facebook or Twitter does (when scrolling the videos are automatically played).

To play with that, I've edited from_youtube.dart from your sample app, the code below.

import 'package:flutter/material.dart';
import 'package:pod_player/pod_player.dart';
import 'package:visibility_detector/visibility_detector.dart';

class PlayVideoFromYoutube extends StatefulWidget {
  const PlayVideoFromYoutube({Key? key}) : super(key: key);

  @override
  State<PlayVideoFromYoutube> createState() => _PlayVideoFromVimeoIdState();
}

class _PlayVideoFromVimeoIdState extends State<PlayVideoFromYoutube> {
  final videos = [
    'https://youtu.be/A3ltMaM6noM',
    'https://www.youtube.com/watch?v=TjBA6jy4ako',
    'https://www.youtube.com/watch?v=HqFgRHTuDyc',
  ];

  late final PodPlayerController controller;
  final videoTextFieldCtr = TextEditingController();

  @override
  void initState() {
    controller = PodPlayerController(
      playVideoFrom: PlayVideoFrom.youtube(videos[0]),
      podPlayerConfig: const PodPlayerConfig(autoPlay: true),
    );

    super.initState();
  }

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Youtube player')),
      body: SafeArea(
        child: ListView(
          children: [
            const SizedBox(height: 200),
            _videoPlayer(videos[0]),
            const SizedBox(height: 900),
            _videoPlayer(videos[1]),
            const SizedBox(height: 900),
            _videoPlayer(videos[2]),
            const SizedBox(height: 200),
          ],
        ),
      ),
    );
  }

  Widget _videoPlayer(String videoUrl) {
    return VisibilityDetector(
      key: Key(videoUrl),
      onVisibilityChanged: (VisibilityInfo info) {
        if (info.visibleFraction == 1) {
          if (controller.isVideoPlaying) return;

          controller.changeVideo(
            playVideoFrom: PlayVideoFrom.youtube(videoUrl),
            playerConfig: const PodPlayerConfig(autoPlay: true),
          );
        } else {
          controller.pause();
        }
      },
      child: PodVideoPlayer(
          controller: controller,
      ),
    );
  }
}
  1. However, there is an issue that videos aren't played automatically after changeVideo even if I'm explicitely calling autoplay: true
          controller.changeVideo(
            playVideoFrom: PlayVideoFrom.youtube(videoUrl),
            playerConfig: const PodPlayerConfig(autoPlay: true),
          );
Simulator.Screen.Recording.-.iPhone.SE.3rd.generation.-.2022-06-23.at.13.58.29.mp4
  1. Also, as you can see the video isn't loaded immediately so I wanted to show thumbnails when the video is loading.
    so I've added videoThumbnail to PodVideoPlayer
      child: PodVideoPlayer(
        controller: controller,
        videoThumbnail: DecorationImage(
          image: NetworkImage(_thumbnailUrl(videoUrl)),
        ),
      ),

However, it doesn't seem to work correctly as well
https://user-images.githubusercontent.com/2264901/175294717-54325703-bcd8-4178-be82-bb905f0eca49.mp4

Autoplay flag

Thanks for a great library. Right now the videos auto play. Is there a flag where i can disable auto play? I couldnt find anything about auto play in the docs.

Seek not working on videos

Hi. I updated the library to the latest version for the autoplay feature. However, after the update, video seek does not work if the PodPlayerConfig class is instantiated as a const.

In the following code, video seek does not work:

podPlayerConfig: const PodPlayerConfig(
        autoPlay: false,
        isLooping: false
      )

In the following code, video seek works:

podPlayerConfig: PodPlayerConfig(
        autoPlay: false,
        isLooping: false
      )

Error: The getter 'qualityLabel' isn't defined for the class 'Muxed

: Error: The getter 'qualityLabel' isn't defined for the class 'MuxedStreamInfo'.
../…/controllers/pod_video_quality_controller.dart:101

  • 'MuxedStreamInfo' is from 'package:youtube_explode_dart/src/videos/streams/muxed_stream_info.dart' ('../../../.pub-cache/hosted/pub.dartlang.org/youtube_explode_dart-1.9.10/lib/src/videos/streams/muxed_stream_info.dart').
    package:youtube_explode_dart/…/streams/muxed_stream_info.dart:1
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'qualityLabel'.

            quality: int.parse(element.qualityLabel.split('p')[0]),
                                       ^^^^^^^^^^^^
    

[Question] Background playing functionality

Hello.

I am so surprised with this package and find it amazing! There are a lot of functionalities that simply work out of the box and that's awesome. Great job on the package! ❤️ 😄

I am curious whether there will be support for background playing sometime in the near future (or at all)? More like something when the app is running in the background or the device is locked (when on mobile, of course).

[Futter 3.0]

flutter 3.0 upgrade version
Pod_player 0.0.5
I upgraded two software and encountered the following error.
Are the others okay?
flutter

How to add gesture in full screen mode?

my code:

GestureDetector(
      onPanEnd: (details) {
          controller.disableFullScreen(context);
      },
      child: PodVideoPlayer(
          matchFrameAspectRatioToVideo: true,
          controller: controller,
          alwaysShowProgressBar: false,
      ),
),

But this code only work on Portrait mode

[Feature Request] Full Screen By Default

Hello,
Firstly, Thanks to the developers and contributors of this awesome Video-Player package.

I want to request for a simple feature,
For now i see there are only these options in PodPlayerConfig

bool autoPlay = true
bool isLooping = false
bool forcedVideoFocus = false
bool wakelockEnabled = true
int? initialVideoQuality

Can the developer or anyone add one more option/ feature

bool fullScreenByDefault = false

And this should allow the package users to select the default player mode, either fullscreen or the minimized window (which is default for now on android & ios)

And if someone is going to work on it, please add two more options -

bool allowFullScreen = true

To show and hide the Full-Screen button on player, allowing the package users to enable/ disable Full-Screen mode for its users.

bool showOptionsMenu

To show and hide the Top-Right Three Dots Menu button on player.

Unhandled exception on initialize with wrong YouTube video ID

We have a scenario where we receive YouTube video IDs from an API. These IDs is manually inserted by our marketing team. As it's a manually process, errors can happens.

With that in mind, I was trying to test how the pod_player handle a wrong YouTube video ID, and I saw that the initialize method never finishes (in pod_player_controller.dart).

The initialize stuck because a postFrameCallback is fired inside this method. This postFrame receive an exception that is not correctly handled. While this happens, the _checkAndWaitTillInitialized continues in loop, waiting until the _ctr.controllerInitialized returns true, what never happens.

I tried to put a listener and wait for a status of error, but nothing os sent to that listener...
I'll make a fork of this project and resolve this locally. If it's ok, I'll send a PR with that fix.

Add desktop support

I know saying is easier than done but due to the nature of flutter if you can use dart_vlc as a desktop replacement using platform interface then it would be good, also dart_vlc let's you customize the player controls playback speed, source, etc, etc.

Overlay doesn't cover full player when PodVideoPlayer has padding around

As title says, overlay is smaller than the video player when there's padding.
1654073213424
1654073207146

To replicate :
Use the sample app, play a video from a vimeo id (this is the only one I tried but I think it happens on all of them) and add padding around PodVideoPlayer:

@override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Vimeo Player')),
      body: SafeArea(
        child: Center(
          child: ListView(
            shrinkWrap: true,
            children: [
              Padding(
                padding: const EdgeInsets.all(35),
                child: PodVideoPlayer(
                  controller: controller,
                  alwaysShowProgressBar: false,
                ),
              ),
            ],
          ),
        ),
      ),
    );
}`

Launch in full screen mode

Is there any possibility to launch the player directly in full screen mode ?

Tried "controller.enableFullScreen();" in initState And in Build method.
Its giving "mainContext" not initialised

This is the issue
in _PodBaseController => late BuildContext mainContext;

Add Audio Only support

Like if I want to only hear the audio and not view the video.

Either you can add this functionality or tell me how to add it manually by integrating a button in the UI of video player or in the expanded menu of the video player.

The screen is flashing during the initial load.

There's an issue in the initial loading. The screen flashes during some internal state change. I was looking at the sources, but couldn't identify the root cause...

This problem can be found in the example project, within this package.

Example from the example project:
Screen Recording 2022-07-28 at 09 57 31 PM

Example from my app:
Screen Recording 2022-07-28 at 10 01 25 PM

Video list auto-pause.

Hi, awesome package.
The problem I am facing is that when I press play on a video while another one is playing, the previous video doesn't pause. It stops playing but the state remains as playing which causes a few issues.

I'm curious why this hasn't been discussed yet, maybe I am doing something wrong but I am out of ideas.

Thank you ;)

Thumbnail

Can i create thumbnails for video from vimeo using pod player?

Black Screen and loading

hello am using this plugin
I found a problem in this plugin when playing a video initially it takes time to load please suggest to me how to reduce its initial loading time

Add Swipe to seek feature

This is a nice feature to add, good for users who are not in the best posture/mood to double tap.
Swift left to seek backward & right to seek forward just like MX Player.

Black rectangle on Full screen video on iphone

Hello,

I have a strange issue when I go to full screen mode on iphone 11 (ios 15.5).

Simulator Screen Shot - iPhone 11 - 2022-07-27 at 17 29 50

On iphone 8 (ios 15.5), the issue is also there. The difference of the size of the black rectangle is due to the screen h/w ratio I think.

Simulator Screen Shot - iPhone 8 - 2022-07-27 at 17 44 59

I don't have this issue on Android :
Screenshot_20220727_175525

Any idea of what's happening ?
Thanks,
Luc

Additional video controls

Would it be possible to add controls like:

  • Mute
  • YouTube button (redirecting to YT)

like on the following image?
Screenshot 2022-06-23 at 16 51 09

No option to hide custom overlay if the video is playing.

Hi,

I was looking for an option to allow my custom overlay made with the overlayBuilder but never found it.
Either I'm not looking in the right place or it does not exist. So do tell me if exists 🙂

From what I could see:

lib/src/widgets/core/overlays/overlays.dart, line 37:

Stack(
  children: [
    Positioned.fill(
      child: _VideoGestureDetector(
        tag: tag,
        onTap: _podCtr.togglePlayPauseVideo,
        onDoubleTap: () =>
            _podCtr.toggleFullScreenOnWeb(context, tag),
        child: const ColoredBox(
          color: Colors.black38,
          child: SizedBox.expand(),
        ),
      ),
    ),
    _podCtr.overlayBuilder?.call(overlayOptions) ?? const SizedBox(),
  ],
);

That ColoredBox has no condition in order to be hidden or to get removed.
If an option is not necessary, I would suggest to hide the ColoredBox when !_podCtrl.isOverlayVisible.

Regards.

List of controllers to be used in a ListView.builder

Is there a way to add a list of video controllers to be used in a listView.builder.

Let's say I have a list of videos and I want to initialize the video before it shows on the screen (so it won't be loading when on-screen) but also not to dispose of the controller when I scroll up. The ideal approach would be to have a list of controllers (let's say 4 or 5 controllers) and you initialize one controller or more when needed and you don't dispose of the used controllers until a 6th video is close to the screen, so you dispose of the 1st controller (but you still have 2,3,4,5 and 6th video controller) this way even when you scroll down a little bit the controller is still there and when you scroll back up the video plays immediately without loading.

An example of this can be seen here but the issue with this approach (or the player itself) is that it is not smooth when initializing. It stutters a bit, which is not cool when you have a list (which is already barely smooth with all the custom widgets).

Thank you so much and let me know if it is possible.
Best regards.

Black Screen and loading 2 -3 minutes

I am using you tube video, when i use 2-3 minutes loading and show black screen, i use 20 minutes big video how can i solve this problem please help me i want to loading less time

onFullScreenToggle callback

Is there any way to restore the app's PreferredOrientations after exiting fullScreen mode?

The application sets the preferred orientation at startup, but after switching the video to fullscreen and back (even when autoplay to false, just after switching to fullscreen preview), the application starts responding to a change in device orientation.

I did not find anything suitable in the API.

For example, it could be like this:

    controller.onFullScreenOff(() => SystemChrome.setPreferredOrientations([
      DeviceOrientation.portraitUp,
      DeviceOrientation.portraitDown,
    ]));

Can you replace getx with riverpod or provider

Getx is bloat and I don't think you are using all the functionalities of getx for this. Although it comes to personal choice but still I would prefer a river pod/ providers version of this instead of getx.

Add pip mode support

Youtube player in premium mode has this functionality, It goes to pip mode when minimized.

So is it possible to be implemented in pod player?

Support for timestamps

I want to request if anyone is willing to help the ability to add multiple timestamps in a video.
Example: If I have a video of 60 mins long I want to be able to play the video when you first press the play button from min 4 until min 15 and then it skips to min 23 until min 40 and then it plays until the end.

Thank you very much.

How to change timeout time?

I have a list of videos that all start loading at the same time and some of them go in timeout before they finish loading. Is there any way to set after how long the initialisation should go in timeout, or any way to check if a video initialisation went in timeout and redo it?

I'm currently using pod_player version 0.0.6 and this problem seems to only be happening on iOS.

This is the error that AVPlayer is returning:
Unhandled Exception: PlatformException(VideoError, Failed to load video: Tempo di richiesta scaduto (translated in english: request timeout) , null, null).

I'm playing a video from vimeoID.

Additional border on Android device

I'm facing a problem with an Android device (Samsung Galaxy A10 - Android 11), where a strange border is added to the VideoPlayer...

To reproduce, just add a Padding to the example project...
image

While is loading, this not happens...
image

This border not appears on iOS (iPhone 7):
image

Youtube Videos load after taking significant time.

We are using pod player to play youtube video. Everything is perfect. But the only problem is that the videos are taking a significant amount of time to load and start playing.
This is making the plugin unsable, otherwise this is an awesome plugin.
Keep up the good work.

long load time

for videos that over 40 minutes have very long time to star video also if change quality start to load again it takes 15 to 20 seconds

How to use full screen

this player has margin around i want to use full screen this please solve tis problems

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.