youtube_player_flutter icon indicating copy to clipboard operation
youtube_player_flutter copied to clipboard

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

Open horeyes opened this issue 4 years ago • 9 comments

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:

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Version [e.g. 22]

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<MyHomePage> { @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,
        ),
      ),
    ],
  ),
);

} }

horeyes avatar Jul 16 '20 21:07 horeyes

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

arodriguezgb avatar Jul 16 '20 21:07 arodriguezgb

@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.

sarbagyastha avatar Jul 17 '20 03:07 sarbagyastha

Fantastic, thank you @sarbagyastha that was fast.

arodriguezgb avatar Jul 17 '20 03:07 arodriguezgb

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

HenglyEver avatar Jul 17 '20 20:07 HenglyEver

_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

GauravPatni avatar Jul 24 '20 07:07 GauravPatni

@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

97loser avatar Jan 26 '21 07:01 97loser

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

Uvelir avatar Feb 01 '21 17:02 Uvelir

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

muhajirdev avatar May 01 '21 15:05 muhajirdev

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.

suyog-bst avatar Nov 15 '21 09:11 suyog-bst