Update script to include regular expression and display bitrate with media name in alert
This commit is contained in:
parent
2b00d8b546
commit
20d0d9af5c
1 changed files with 4 additions and 2 deletions
|
|
@ -18,6 +18,7 @@
|
|||
const password = "absw3712mcS";
|
||||
const userid = "e55a6ca076a14cb5a6ca9cfaa75498c1";
|
||||
const baseURL = window.origin;
|
||||
const re = /\[(.*)\]/;
|
||||
var apiKey = "38346c399d57454da3bdbf47ba716765";
|
||||
|
||||
// Authorize user
|
||||
|
|
@ -94,7 +95,6 @@
|
|||
|
||||
// Bind get function
|
||||
el.onclick = function () {
|
||||
var bitrate = 0;
|
||||
let url = `${window.origin}/Users/${userid}/Items/${this.parentElement.dataset.id}`;
|
||||
console.log(`Fetching ${url}`);
|
||||
|
||||
|
|
@ -108,8 +108,10 @@
|
|||
.then((response) => response.json())
|
||||
.then((data) =>
|
||||
// Display bitrate
|
||||
|
||||
alert(
|
||||
`${data.MediaStreams[0].BitRate.toString().substring(0, 4)}kbps | ${data.MediaStreams[0].BitRate.toString().length}`
|
||||
`${data.MediaStreams[0].BitRate.toString().substring(0, 4)}kbps | ${data.MediaStreams[0].BitRate.toString().length} | ${re.exec(data.Path)[1]
|
||||
}`
|
||||
)
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue