Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with URL's from Youtube. #97

Closed
Bartozo opened this issue Jun 8, 2021 · 5 comments
Closed

Problem with URL's from Youtube. #97

Bartozo opened this issue Jun 8, 2021 · 5 comments

Comments

@Bartozo
Copy link

Bartozo commented Jun 8, 2021

Used dependencies:

  • flick_video_player: 0.3.1
  • youtube_explode_dart: 1.9.4
  • dart SDK 2.11.0

Problem:

I can't use any URL's from youtube in that video player plugin on Android devices (I Didn't test this on iOS). I have tried even using youtube_explode_dart to get url of the video, but nothing worked.
It throws me this error all the time, so I assume that video player don't know what video format is.

I/ExoPlayerImpl(30339): Init 5005f9a [ExoPlayerLib/2.12.1] [generic_x86_arm, sdk_gphone_x86, Google, 30] E/ExoPlayerImplInternal(30339): Playback error E/ExoPlayerImplInternal(30339): com.google.android.exoplayer2.ExoPlaybackException: Source error E/ExoPlayerImplInternal(30339): at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:554) E/ExoPlayerImplInternal(30339): at android.os.Handler.dispatchMessage(Handler.java:102) E/ExoPlayerImplInternal(30339): at android.os.Looper.loop(Looper.java:223) E/ExoPlayerImplInternal(30339): at android.os.HandlerThread.run(HandlerThread.java:67) E/ExoPlayerImplInternal(30339): Caused by: com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors (FlvExtractor, FlacExtractor, WavExtractor, FragmentedMp4Extractor, Mp4Extractor, AmrExtractor, PsExtractor, OggExtractor, TsExtractor, MatroskaExtractor, AdtsExtractor, Ac3Extractor, Ac4Extractor, Mp3Extractor) could read the stream. E/ExoPlayerImplInternal(30339): at com.google.android.exoplayer2.source.BundledExtractorsAdapter.init(BundledExtractorsAdapter.java:92) E/ExoPlayerImplInternal(30339): at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1024) E/ExoPlayerImplInternal(30339): at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:415) E/ExoPlayerImplInternal(30339): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) E/ExoPlayerImplInternal(30339): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) E/ExoPlayerImplInternal(30339): at java.lang.Thread.run(Thread.java:923)

Expectation:

video player will handle youtube URL and video will be playable.

Code

This is my Widget designed to show only youtube videos:

Widget _buildYoutubeVideoPlayer() {
  return FutureBuilder<Video>(
    future: YoutubeExplode().videos.get("https://www.youtube.com/watch?v=aAmP-WcI6dg"),
    builder: (context, snapshot) {
      switch (snapshot.connectionState) {
        case ConnectionState.waiting:
          return Text('Loading....');
        default:
          if (snapshot.hasError) {
            return Text('Error: ${snapshot.error}');
          } else {
            return SamplePlayer(url: snapshot.data.url);
          }
      }
    }
  );
}

Sample player is nothing more than an example of flick_video_player library

class SamplePlayer extends StatefulWidget {
  final String url;

  SamplePlayer({
    Key key,
    @required this.url
  }) : super(key: key);

  @override
  _SamplePlayerState createState() => _SamplePlayerState();
}

class _SamplePlayerState extends State<SamplePlayer> {
  FlickManager flickManager;

  @override
  void initState() {
    super.initState();
    flickManager = FlickManager(
      videoPlayerController:
      VideoPlayerController.network(widget.url),
    );
  }

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

  @override
  Widget build(BuildContext context) {
    return Container(
      child: FlickVideoPlayer(
          flickManager: flickManager
      ),
    );
  }

}
@MeAtPros
Copy link

MeAtPros commented Jun 8, 2021

I noticed a similar error ... can you fix it quickly?

EDIT:
@ahujaraghav , @rajajain08geekyants Any update in this threat?

@geekruchika
Copy link
Collaborator

Hi @Bartozo
Are you still stuck with this issue?

@geekruchika
Copy link
Collaborator

var manifest = await yt.videos.streamsClient.getManifest('$vId');
    // var manifest = await yt.videos.streamsClient.getManifest('wku7zvDDRk0');
    flickManager!.handleChangeVideo(VideoPlayerController.network(
        manifest.video.first.url.toString())..play());

This worked for me. Please feel free to open the issue if needed.

@Bartozo
Copy link
Author

Bartozo commented Aug 25, 2021

We have abandoned using this plugin. In that moment I can't confirm if your solution works or no't.
Could you provide your solution with an example widget?

@abdullah230695
Copy link

flickManager!.handleChangeVideo(VideoPlayerController.network(
manifest.video.first.url.toString())..play());

how to initialise flickmanager when using this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants