hls.js icon indicating copy to clipboard operation
hls.js copied to clipboard

Add public url getter to return the currently playing url

Open ibobo opened this issue 1 year ago • 2 comments

This PR will...

Make the url property a public getter, and create a private _url for internal use.

Why is this Pull Request needed?

As discussed in issue #6376, reading the currently playing url can be beneficial in some situations, and, since the url property exists and is marked as private, this was the best solution for the issue (as suggested by @robwalch).

Are there any points in the code the reviewer needs to double check?

No. But I didn't find a suitable spot to add something in the documentation, since also loadSource isn't documented.

Resolves issues:

#6376

Checklist

  • [x] changes have been done against master branch, and PR does not conflict
  • [x] new unit / functional tests have been added (whenever applicable)
  • [x] API or design changes are documented in API.md

ibobo avatar May 12 '24 14:05 ibobo

Hi @ibobo,

Would you mind adding an entry to docs/API.md for this new getter? Adding hls.url with description like the other getters ("get : string of current HLS asset passed to loadSource, otherwise null") under Network Loading Control API: https://github.com/video-dev/hls.js/blob/master/docs/API.md#network-loading-control-api

robwalch avatar May 28 '24 20:05 robwalch

Sorry for the late response @robwalch, did that now!

Thanks

ibobo avatar Jun 03 '24 11:06 ibobo