-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use the native youtube view for the native
It's opening the in app tracked at sarbagyastha/youtube_player_flutter#462
- Loading branch information
Showing
8 changed files
with
90 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,4 @@ SPEC CHECKSUMS: | |
|
||
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c | ||
|
||
COCOAPODS: 1.10.0 | ||
COCOAPODS: 1.10.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,3 @@ | ||
import 'package:flutter/material.dart'; | ||
// import 'package:youtube_player_flutter/youtube_player_flutter.dart'; | ||
import 'package:youtube_player_iframe/youtube_player_iframe.dart'; | ||
|
||
class YoutubeWidget extends StatefulWidget { | ||
final String youtubeId; | ||
|
||
const YoutubeWidget({Key? key, required this.youtubeId}) : super(key: key); | ||
|
||
@override | ||
_DetailState createState() => _DetailState(); | ||
} | ||
|
||
class _DetailState extends State<YoutubeWidget> { | ||
late final YoutubePlayerController _controller; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
|
||
_controller = YoutubePlayerController(initialVideoId: widget.youtubeId); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return YoutubePlayerControllerProvider( | ||
// Provides controller to all the widget below it. | ||
controller: _controller, | ||
child: const YoutubePlayerIFrame( | ||
// ignore: avoid_redundant_argument_values | ||
aspectRatio: 16 / 9, | ||
), | ||
); | ||
} | ||
} | ||
export "youtube_interface.dart" | ||
if (dart.library.html) "./youtube_web.dart" | ||
if (dart.library.io) "./youtube_native.dart"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import 'package:flutter/widgets.dart'; | ||
|
||
class YoutubeWidget extends StatefulWidget { | ||
final String youtubeId; | ||
|
||
const YoutubeWidget({Key? key, required this.youtubeId}) : super(key: key); | ||
|
||
@override | ||
_YouTubeWidgetState createState() => _YouTubeWidgetState(); | ||
} | ||
|
||
class _YouTubeWidgetState extends State<YoutubeWidget> { | ||
@override | ||
Widget build(BuildContext context) { | ||
throw UnimplementedError("you have to import youtube.dart instead"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:youtube_player_flutter/youtube_player_flutter.dart'; | ||
|
||
class YoutubeWidget extends StatefulWidget { | ||
final String youtubeId; | ||
|
||
const YoutubeWidget({Key? key, required this.youtubeId}) : super(key: key); | ||
|
||
@override | ||
_YouTubeWidgetState createState() => _YouTubeWidgetState(); | ||
} | ||
|
||
class _YouTubeWidgetState extends State<YoutubeWidget> { | ||
late final YoutubePlayerController _controller; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
|
||
_controller = YoutubePlayerController(initialVideoId: widget.youtubeId); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return YoutubePlayer(controller: _controller); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:youtube_player_iframe/youtube_player_iframe.dart'; | ||
|
||
class YoutubeWidget extends StatefulWidget { | ||
final String youtubeId; | ||
|
||
const YoutubeWidget({Key? key, required this.youtubeId}) : super(key: key); | ||
|
||
@override | ||
_YouTubeWidgetState createState() => _YouTubeWidgetState(); | ||
} | ||
|
||
class _YouTubeWidgetState extends State<YoutubeWidget> { | ||
late final YoutubePlayerController _controller; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
|
||
_controller = YoutubePlayerController(initialVideoId: widget.youtubeId); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return YoutubePlayerControllerProvider( | ||
// Provides controller to all the widget below it. | ||
controller: _controller, | ||
child: const YoutubePlayerIFrame( | ||
// ignore: avoid_redundant_argument_values | ||
aspectRatio: 16 / 9, | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters