Coder Social home page Coder Social logo

Comments (6)

artths avatar artths commented on May 23, 2024 1

Also this check should be removed from didUpdateWidget

    if (widget.url == null || widget.url.isEmpty) {
      _disposePlatformView();
    }

Because it will crash player when I just want to pause it:

      _videoPlayer = VideoPlayout(
        desiredState: PlayerState.STOPPED,
      );

Want you do some PlayerController so we could control the video state without needing of recreate widget?

I will do PR when find all the errors.

from flutter_playout.

KhuramKhalid avatar KhuramKhalid commented on May 23, 2024

If we change the _onMediaChanged() method in lib/video.dart to following then this issue could be fixed.

void _onMediaChanged() {
    if (widget.url != null) {
      if (_methodChannel == null) {
        _setupPlayer();
      } else {
        _methodChannel.invokeMethod("onMediaChanged", {
          "autoPlay": widget.autoPlay,
          "url": widget.url,
          "title": widget.title,
          "subtitle": widget.subtitle,
          "isLiveStream": widget.isLiveStream,
        });
      }
    }
  }

I tested this by first passing null as URL which resulted in a plan Container() and then when I pass an actual URL and rebuild, it creates the player. Let me know your thoughts on this.

from flutter_playout.

artths avatar artths commented on May 23, 2024

Yes, it works if passing null, but will enter useless state if we supply some broken link to it:

  Video _videoPlayer = Video(
    url: "http://some_site.com/broken_link.mp4",
  );

Native view will not be created because of the isPlayable check but native channel will.

from flutter_playout.

KhuramKhalid avatar KhuramKhalid commented on May 23, 2024

That's true. The change you mentioned in #10 will fix this. Moving init code out of view() in native iOS. Then media change can call init again if player was never initialised. Would it be possible for you to create a PR for this? Otherwise I'll try working on this later.

from flutter_playout.

artths avatar artths commented on May 23, 2024

Sorry, was working on another project.
I created PR with the changes you propose in _onMediaChanged() and also in native part, because it crashes if I supply null url since last commit.

from flutter_playout.

KhuramKhalid avatar KhuramKhalid commented on May 23, 2024

Thanks for the PR. I've pushed a new version out which includes this. See v1.0.35

from flutter_playout.

Related Issues (20)

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.