PierfrancescoSoffritti / android-youtube-player

YouTube Player library for Android and Chromecast, stable and customizable.
https://pierfrancescosoffritti.github.io/android-youtube-player/
MIT License
3.44k stars 765 forks source link

Add a util that extract video id from YouTube url #1137

Closed MahmoudMabrok closed 6 months ago

MahmoudMabrok commented 7 months ago

Feature Request

Describe your idea

a util function to extract video id from url

Expected behavior and realization

playerView.loadFromUrl(url, startTime)

PierfrancescoSoffritti commented 7 months ago

Sure, we could add that. What would be the benefit over the current functions based on id? My only concern is polluting the API too much, with nearly duplicated functions.

MahmoudMabrok commented 7 months ago

My current app and most of apps I dealt with, we had the links of videos as full url not as id only, so every user to lib will create that util and add unit tests to it

So I thought to have it, it is like time utils

MahmoudMabrok commented 7 months ago

Oh, sorry.

It should be a separate util not as extension to YouTube player as I shared.

LinksUtil.getIDFromUrl.

PierfrancescoSoffritti commented 7 months ago

Makes sense, feel free to send a pull request :) I think it should probably be in the form of new functions or extension functions.

MahmoudMabrok commented 6 months ago

@PierfrancescoSoffritti I did the PR and added Unit tests for it, please check it.

MahmoudMabrok commented 6 months ago

I am closing it, as you see it is not needed.

If anyone need it, will be on my fork.