This file contains 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> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>AVI Video Player</title> | |
</head> | |
<body> |
This file contains 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> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>webcodecs</title> | |
<style> | |
body { | |
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; | |
margin: 0; |
This file contains 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 std = @import("std"); | |
const builtin = @import("builtin"); | |
pub fn build(b: *std.Build) !void { | |
const av = b.option(bool, "av", "Compile ffmpeg") orelse false; | |
const optimize = b.standardOptimizeOption(.{ .preferred_optimize_mode = .ReleaseFast }); | |
const dep_stb = b.dependency("stb", .{}); | |
const dep_ffmpeg = b.dependency("ffmpeg", .{}); | |
// Add a new step for compiling Ffmpeg |
This file contains 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
import { Injectable } from '@angular/core'; | |
import { Socket } from 'socket.io-client'; | |
// Stream Audio | |
let bufferSize = 2048, | |
AudioContext; | |
//audioStream constraints | |
const constraints = { | |
audio: true, |
This file contains 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
import { io, Socket } from 'socket.io-client'; | |
import {AudioStreamer} from 'src/app/app.service'; | |
constructor(private audioStreamer: AudioStreamer) { | |
this.liveTranscription = ''; | |
this.socket = io('https://localhost:3000'); | |
this.socket.on('connect', () => { | |
console.log('Socket Connection: ', this.socket?.connected); | |
}) | |
this.audioStreamer._socket = this.socket; |
This file contains 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
restartStream() { | |
if (this.recognizeStream) { | |
this.recognizeStream.end(); | |
this.recognizeStream.removeAllListeners(); | |
this.recognizeStream = null; | |
} | |
if (this.resultEndTime > 0) { | |
this.finalRequestEndTime = this.isFinalEndTime; | |
} | |
this.resultEndTime = 0; |
This file contains 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
/** | |
* Receives streaming data and writes it to the recognizeStream for transcription | |
* | |
* @param {Buffer} data A section of audio data | |
*/ | |
receiveData(data: DataView) { | |
if ( | |
this.newStream && | |
this.lastAudioInput.length !== 0 && | |
this.recognizeStream |
This file contains 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
import speech, { SpeechClient } from '@google-cloud/speech'; | |
import { google } from '@google-cloud/speech/build/protos/protos'; | |
import * as pumpify from 'pumpify'; | |
import chalk from 'chalk'; | |
import { Socket } from 'socket.io'; | |
let speechClient: SpeechClient | null = null; | |
class SpeechToTextUtils { | |
recognizeStream!: pumpify | null; | |
resultEndTime = 0; |
This file contains 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
import { google } from "@google-cloud/speech/build/protos/protos"; | |
import { Server, Socket } from "socket.io"; | |
import speechToTextUtils from "./speechToTextUtils"; | |
io.on("connection", (socket: Socket) => { | |
console.log("Socket Connection: ", socket.connected); | |
console.log("Socket Id: ", socket.id); | |
speechToTextUtils._socket = socket; | |
// Define socket eventListeners. |
This file contains 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
import express, { Express, Request, Response } from "express"; | |
import { createServer } from "https"; | |
const app: Express = express(); | |
const server = createServer( | |
{ | |
key: fs.readFileSync("key.pem"), | |
cert: fs.readFileSync("cert.pem"), | |
}, | |
app | |
); |
NewerOlder