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

Allow getting the current URL #6376

Open
ibobo opened this issue Apr 23, 2024 · 2 comments
Open

Allow getting the current URL #6376

ibobo opened this issue Apr 23, 2024 · 2 comments
Labels
Feature proposal Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix.

Comments

@ibobo
Copy link

ibobo commented Apr 23, 2024

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.

@ibobo ibobo added Feature proposal Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. labels Apr 23, 2024
@robwalch
Copy link
Collaborator

robwalch commented Apr 23, 2024

Provide a public getUrl(): string | null method to access the url value.

How about making hls.url a getter (read-only)?

private _url: string | null = null; // replaces `url` property

public get url(): string | null {
  return this._url;
}

Additional context

Why do you need to read the url passed to loadSource()?

@ibobo
Copy link
Author

ibobo commented Apr 24, 2024

How about making hls.url a getter (read-only)?

private _url: string | null = null; // replaces `url` property

public get url(): string | null {
  return this._url;
}

That could even be better, if it doesn't break older code.

Additional context

Why do you need to read the url passed to loadSource()?

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature proposal Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix.
Projects
None yet
Development

No branches or pull requests

2 participants