-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Allow getting the current URL #6376
Comments
How about making private _url: string | null = null; // replaces `url` property
public get url(): string | null {
return this._url;
}
Why do you need to read the url passed to |
That could even be better, if it doesn't break older code.
In my case I'm using Hls in a React component and I need to check what url it is playing to avoid stopping and restarting the same stream in some cases. But, as a principle, I think that being able to read back the data you put into something can always be beneficial in a number of ways. |
@ibobo I'd be happy to accept a change in the form of a PR that makes
This wouldn't break code that follows hls.js public API or TypeScript definitions. Introspecting or serializing instances or setting |
Hi @robwalch I did send a PR, thanks! |
Is your feature request related to a problem? Please describe.
Right now, the
url
field is private, which means in TypeScript it's not possible to read it, but that would be useful.Describe the solution you'd like
Provide a
public getUrl(): string | null
method to access the url value.Additional context
Right now, from JS there's no problem at all reading the value, in TypeScript you need to do something like
(hls as any).url
to be able to read it.The text was updated successfully, but these errors were encountered: