sarbagyastha / youtube_player_flutter

A Flutter plugin for inline playback or streaming of YouTube videos using the official iFrame Player API.
https://youtube.sarbagyastha.com.np
BSD 3-Clause "New" or "Revised" License
692 stars 785 forks source link

Tapping Information opens a webview within the app instead of opening video on Youtube App. #299

Open horeyes opened 4 years ago

horeyes commented 4 years ago

Describe the bug Hello,

When I tap on the Avatar, title, or watch later the apps open youtube in a webview. I would like the app to launch youtube instead. Is there a method available that would allow me to do this? Ideally, I would've like to hide the avatar and information from the player, but it looks like it's require by the YoutubeIFrameApi.

To Reproduce When the player it's paused or started:

  1. Tap Avatar or Title,
  2. User Profile or video will open in a webview within the app in Desktop size.

Expected behavior Open Youtube App

Screenshots If applicable, add screenshots to help explain your problem.

  1. Video Info Displaying image

  2. Webview image

Technical Details:

Code import 'package:flutter/material.dart'; import 'package:youtube_player_iframe/youtube_player_iframe.dart';

void main() { runApp(MyApp()); }

class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, visualDensity: VisualDensity.adaptivePlatformDensity, ), home: MyHomePage(title: 'Flutter Demo Home Page'), ); } }

class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key);

final String title;

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

class _MyHomePageState extends State { @override Widget build(BuildContext context) { YoutubePlayerController _controller = YoutubePlayerController( initialVideoId: 'j4_Pj1rYpr8', params: YoutubePlayerParams( startAt: Duration(seconds: 0), showControls: true, showFullscreenButton: true, autoPlay: true, forceHD: true, ), );

return Scaffold(
  appBar: AppBar(
    title: Text(widget.title),
  ),
  body: Column(
    mainAxisSize: MainAxisSize.max,
    children: <Widget>[
      Container(
        height: MediaQuery.of(context).orientation == Orientation.portrait
            ? MediaQuery.of(context).size.height * .25
            : MediaQuery.of(context).size.height * .81,
        width: double.infinity,
        child: YoutubePlayerIFrame(
          controller: _controller,
          aspectRatio: 16 / 9,
        ),
      ),
    ],
  ),
);

} }

arodriguezgb commented 4 years ago

I am having the same issue is there any workaround or settings we can change to fix this behaviour ?

sarbagyastha commented 4 years ago

@horeyes @arodriguezgb With v1.0.1, I have disabled navigation inside webview. So the issue of launching youtube inside webview shouldn't exist anymore.

Also, added a method hideTopMenu() to hide those titles & share icons. But using it may violate YouTube's TOS.

arodriguezgb commented 4 years ago

Fantastic, thank you @sarbagyastha that was fast.

HenglyEver commented 4 years ago

I'm glad to hear that you have disabled navigation inside webview but please have a look at this, I think this considered as a bug, on hold of video player reveal the list of options (equivalent to right-click on youtube player), do you think that behavior should be disabled as well? youtube player

P.S. after upgrading to v1.0.1, the autoPlay param doesn't seem to work, can you please confirm? Thanks :D

GauravPatni commented 4 years ago

_controller.hideTopMenu() & _controller.hidePauseOverlay() not working from me . Even after using above -- share, watch later, info etc are visible even for pause overlay.

Please check

97loser commented 3 years ago

@HenglyEver
Have you got any solutions

I'm glad to hear that you have disabled navigation inside webview but please have a look at this, I think this considered as a bug, on hold of video player reveal the list of options (equivalent to right-click on youtube player), do you think that behavior should be disabled as well? youtube player

P.S. after upgrading to v1.0.1, the autoPlay param doesn't seem to work, can you please confirm? Thanks :D

Uvelir commented 3 years ago

I'm glad to hear that you have disabled navigation inside webview but please have a look at this, I think this considered as a bug, on hold of video player reveal the list of options (equivalent to right-click on youtube player), do you think that behavior should be disabled as well? youtube player

P.S. after upgrading to v1.0.1, the autoPlay param doesn't seem to work, can you please confirm? Thanks :D

The same happened to me on iOS, package version 6.1.1

muhajirdev commented 3 years ago

yeah same thing happend to m3 @Uvelir , did you found a solution?

suyog-bst commented 2 years ago

Regarding this feature, app redirection seems to be working fine in v2.1.0 but clicking the title or YouTube logo doesn't seem to work anymore.

Can this feature be restored please.

Edit: nvm. Saw that you'd added this a feature. However, I do feel that this should be changed as YouTube ToS mandates behavior of player shouldn't change and we are essentially changing the behavior.