-
Notifications
You must be signed in to change notification settings - Fork 997
Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Package
youtube_player_flutter
What happened?
Playback on other apps has been disabled by the video owner
Error Code: 150
What is the expected behaviour?
The video should either:
Play normally inside the app, or
Provide a clear way to handle/recover from this restriction (fallback, callback, or documentation guidance).
How to reproduce?
Add youtube_player_flutter: ^9.1.3
Initialize YoutubePlayerController
Try playing a YouTube video that has embedding restrictions
The player displays Error Code 150
Future _initializeYouTubePlayer() async {
if (currentVideoKey == null || currentVideoKey!.isEmpty || _isDisposing) {
return;
}
try {
final controller = YoutubePlayerController(
initialVideoId: currentVideoKey!,
flags: const YoutubePlayerFlags(
autoPlay: true,
mute: false,
enableCaption: false,
),
);
controller.addListener(() {
if (mounted && !_isDisposing) {
setState(() {
_isFullScreen = controller.value.isFullScreen;
});
}
});
if (mounted && !_isDisposing) {
setState(() {
_youtubeController = controller;
});
}
if (kDebugMode) print('YouTube player initialized successfully');
} catch (e) {
if (kDebugMode) print('Error initializing YouTube player: $e');
ScaffoldMessenger.of(context).showSnackBar(
AppSnackBar.customWithIcon(
message: 'Error initializing YouTube player.',
backgroundColor: Colors.redAccent,
icon: Icons.error_outline,
),
);
}
}
Flutter Doctor Output
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels