can i run youtubeplayer iframe inside the betterplayer package in flutter?
hello i am new to flutter and mobile app development so this may be dumb question sorry but i have a flutter packgae youtubeiframeplayer and another betterplayer. What i wanted is to play youtube video that runs with iframe packgae inside the betterplayer packgae because the betterplayer has many options and it dosen't support youtube urls can u please help me.
here is what i tried
import 'package:flutter/material.dart';
import 'package:better_player/better_player.dart';
import 'package:youtube_player_iframe/youtube_player_iframe.dart';
import 'package:uplay/config/routers.dart';
class VideoPlayer extends StatefulWidget {
final String url1;
const VideoPlayer(this.url1);
@override
_VideoPlayerState createState() => _VideoPlayerState();
}
class _VideoPlayerState extends State<VideoPlayer> {
late BetterPlayerController _betterPlayerController;
static late YoutubePlayerController _controller;
var isEnabled = true;
List<VideoPlayer> videoResult = [];
//late String url1;
void betterPlayer() {
//super.initState();
//BetterPlayerDataSource betterPlayerDataSource = startVideo();
_betterPlayerController = BetterPlayerController(
const BetterPlayerConfiguration(
handleLifecycle: false,
autoDetectFullscreenAspectRatio: true,
),
);
//super.initState();
}
@override
YoutubePlayerController initState() {
return YoutubePlayerController(
initialVideoId: YoutubePlayerController.convertUrlToId(widget.url1)!,
params: const YoutubePlayerParams(
autoPlay: true,
color: 'black',
strictRelatedVideos: true,
showFullscreenButton: true,
));
super.initState();
}
//THe problem is in here
@override
Widget build(BuildContext context) {
return AspectRatio(
aspectRatio: 16 / 9,
child: YoutubePlayerControllerProvider(
//i don't know how to mix it together
controller: _controller,
child: BetterPlayer(
controller: _betterPlayerController,
)));
}
}
from Recent Questions - Stack Overflow https://ift.tt/3qNx9m6
https://ift.tt/eA8V8J
Comments
Post a Comment