Skip to content

Instantly share code, notes, and snippets.

@UCIS
UCIS / gist:845eda1755d38eddfc3f0f99268c27da
Created June 17, 2020 18:50
Opus/WebM player in JavaScript
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() {
@UCIS
UCIS / gist:983f2c16d36aee7f75cff4ac477d6805
Created June 17, 2020 18:42
Opus in WebM packetizer
class WebmPacketizer : IPacketizer {
private UInt64 position = 0;
static WebmPacketizer () {
}
public WebmPacketizer() {
}
private static Byte[] Concat(params Byte[][] parts) {
@UCIS
UCIS / gist:c52757fef62239d502806f53b6700a58
Created June 17, 2020 18:40
Opus in Ogg packetizer
class OggPacketizer : IPacketizer {
static UInt32[] checksumTable;
static UInt32 serial_counter = 1;
uint pageIndex = 0;
uint serial;
UInt64 position = 0;
static OggPacketizer() {
initChecksumTable();
}