return ListTile(
title: GestureDetector(
onTap: () async {
String youtubeUrl =
"https://www.youtube.com/watch?v=$videoURL";
if (await canLaunch(youtubeUrl)) {
await launch(youtubeUrl);
} else {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(
"Couldn't open the YouTube video. Check the URL or your device settings."),
));
}
},
When I try tapping on the url is showing "Couldn't open the YouTube video.
I was expecting it to launch the youtube url either by opening on the app or web
The url is Correct and is working if i copy it and paste on my chromeenter image description here that is what is showing in my console when I tap on the url
2
Answers
For Android, you have to specify
https
scheme in yourandroid/app/src/main/AndroidManifest.xml
like this:For iOS, inside
ios/Runner/Info.plist
add this key-array:The need of these configurations is mentioned in the package description, however it doesn’t give enough example to configure for
https
scheme so you can take the example from this answer as a guide.The url is actually invalid.
Skip setting the base url: