Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I'm unable to play YouTube shorts #210

Open
BusayoSamuel opened this issue Jun 13, 2024 · 1 comment
Open

I'm unable to play YouTube shorts #210

BusayoSamuel opened this issue Jun 13, 2024 · 1 comment

Comments

@BusayoSamuel
Copy link

BusayoSamuel commented Jun 13, 2024

I get the invalid argument error whenever I attempt to play YouTube shorts

@Essenbay
Copy link

Essenbay commented Jul 5, 2024

Use this function to get youtube code

   String getYoutubeVideoId(String url) {
    final RegExp regExp = RegExp(
        r"(?:https?:\/\/)?(?:(?:www\.)?youtube\.com\/(?:(?:shorts\/)|(?:watch\?v=))|(?:youtu.be\/))([\-a-zA-Z0-9_]+)");
    final match = regExp.firstMatch(url);
    final result = match?.group(1) ?? "";
    return result;
  }

And set it to datasource of controller

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants