Skip to content

Instantly share code, notes, and snippets.

@UCIS
UCIS / gist:845eda1755d38eddfc3f0f99268c27da
Created Jun 17, 2020
Opus/WebM player in JavaScript
View gist:845eda1755d38eddfc3f0f99268c27da
function OpusWebmPacker() {
var channels = 2;
var sample_rate = 48000;
var position = 0;
var packets = [];
var buffer = new Uint8Array(4 + 1275);
var buffer_offset = 0;
function Concat() {
View gist:983f2c16d36aee7f75cff4ac477d6805
class WebmPacketizer : IPacketizer {
private UInt64 position = 0;
static WebmPacketizer () {
}
public WebmPacketizer() {
}
private static Byte[] Concat(params Byte[][] parts) {
View gist:c52757fef62239d502806f53b6700a58
class OggPacketizer : IPacketizer {
static UInt32[] checksumTable;
static UInt32 serial_counter = 1;
uint pageIndex = 0;
uint serial;
UInt64 position = 0;
static OggPacketizer() {
initChecksumTable();
}