This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
import * as fs from 'fs'; | |
import * as path from 'path'; | |
import { fileURLToPath } from 'url'; | |
const VERSION_REGXP = | |
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/; | |
const URL_REGXP = /^[a-zA-Z]+:\/\//; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ================================ HTML-LOGGER ================================ | |
// | |
// This code will display a semi-opaque div HTMLElement on the top of the screen | |
// containing log produced through `console` methods (and optionally logging | |
// requests). | |
// | |
// You can configure it by updating the variables below. | |
/** | |
* To set to `true` to also show HTTP(S) requests made through either the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const base64abc = [ | |
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", | |
"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", | |
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", | |
"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", | |
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/", | |
]; | |
/** | |
* Convert an array of bytes into a base64 string. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Note: if not on localhost, don't forget to add something like: | |
// `<meta http-equiv="Content-Security-Policy" content="connect-src 'self' ws: wss:">` | |
// to the HTML page to allow websocket connections to external websites | |
// SERVER_URL of the server (relative to the client). | |
// Localhost by default | |
const SERVER_URL = "ws://127.0.0.1"; | |
// Port on which the server is listening. | |
// If going through ngrok, you can set it to `null` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
// This constant can also be computed with the following algorithm: | |
const base64abc = [], | |
A = "A".charCodeAt(0), | |
a = "a".charCodeAt(0), | |
n = "0".charCodeAt(0); | |
for (let i = 0; i < 26; ++i) { | |
base64abc.push(String.fromCharCode(A + i)); | |
} | |
for (let i = 0; i < 26; ++i) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
const cLog = console.log; | |
const cWarn = console.warn; | |
const cError = console.error; | |
const cInfo = console.info; | |
const cDebug = console.debug; | |
function addTSToArgumentList(argList) { | |
const ret = [performance.now()]; | |
for (let i = 0; i < argList.length; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!-- | |
This file allows to quickly test if starting a content at a position different | |
from `0` after the media segments have been pushed works. | |
To do that: | |
1. You might want to update the variables at the top of the script (default | |
values should be alright but maybe the content is not available anymore). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!-- | |
This file allows to quickly test if starting a content at a position different | |
from `0` works. | |
More precizely, it tests that seeking as soon as the loadedmetadata event is | |
received works on the current platform. | |
To do that: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function be4toi(bytes, offset) { | |
return ((bytes[offset + 0] * 0x1000000) + | |
(bytes[offset + 1] * 0x0010000) + | |
(bytes[offset + 2] * 0x0000100) + | |
(bytes[offset + 3])); | |
} | |
function be8toi(bytes, offset) { | |
return (((bytes[offset + 0] * 0x1000000) + | |
(bytes[offset + 1] * 0x0010000) + | |
(bytes[offset + 2] * 0x0000100) + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Pretty print a TimeRanges Object, to see the current content of it in a | |
* one-liner string. | |
* | |
* @example | |
* This function is called by giving it directly the TimeRanges, such as: | |
* ```js | |
* prettyPrintBuffered(document.getElementsByTagName("video")[0].buffered); | |
* ``` | |
* |
NewerOlder