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
| # Requests for socket.io are passed on to Node on port 3001 | |
| location ~* \.io { | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| proxy_set_header Host $http_host; | |
| proxy_set_header X-NginX-Proxy false; | |
| proxy_pass http://localhost:3001; | |
| proxy_redirect off; |
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
| useEffect(() => { | |
| socket.current = | |
| process.env.NODE_ENV === 'production' | |
| ? io(productionWsUrl + streamUrlParams, { transports: ['websocket'] }) | |
| : io(developmentWsUrl + streamUrlParams, { transports: ['websocket'] }) | |
| socket.current.on('connect', () => { | |
| // either with send() | |
| console.log('WebSocket Open') | |
| }) |
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 { launch, getStream } = require('puppeteer-stream') | |
| const fs = require('fs') | |
| // node arguments are present from the third position going forward. | |
| const args = process.argv.slice(2) | |
| const file = fs.createWriteStream(`./reports/videos/${args[0]}.mp4`) | |
| async function puppeteerStream() { | |
| const browser = await launch() |
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 puppeteer = require('puppeteer') | |
| const { PuppeteerScreenRecorder } = require('puppeteer-screen-recorder') | |
| // node arguments are present from the third position going forward. | |
| const args = process.argv.slice(2) | |
| ;(async () => { | |
| const browser = await puppeteer.launch() | |
| const page = await browser.newPage() |
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 puppeteer = require('puppeteer') | |
| // node arguments are present from the third position going forward. | |
| const args = process.argv.slice(2) | |
| ;(async () => { | |
| const browser = await puppeteer.launch({ headless: true }) | |
| const page = await browser.newPage() | |
| // create a room called room |
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
| // twilio STUN AND TURN SERVER CREDENTIALS | |
| app.post('/api/twilio', async (req, res) => { | |
| const baseUrl = `https://api.twilio.com/2010-04-01/Accounts/${accountSid}/Tokens.json` | |
| const token = await axios | |
| .post( | |
| baseUrl, | |
| {}, | |
| { | |
| auth: { |
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 ffmpegTee = (youtube, twitch, facebook) => { | |
| return [ | |
| '-i', | |
| '-', | |
| // select first stream intended for output | |
| '-map', | |
| '0', | |
| // video codec config: low latency, adaptive bitrate | |
| '-c:v', | |
| 'libx264', |
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 ffmpeg = child_process.spawn('ffmpeg', [ | |
| // the input | |
| '-i', | |
| '-', | |
| // video codec config: low latency, adaptive bitrate, | |
| // list of presets: https://trac.ffmpeg.org/wiki/Encode/H.264 | |
| // tune zerolatency is good for fast encoding and low-latency streaming | |
| // g:v 60 ==> https://www.reddit.com/r/ffmpeg/comments/redaa2/while_livestreaming_to_youtube_using_ffmpeg_i_get/ | |
| '-c:v', |
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 express = require('express') // call express | |
| const app = express() // define our app using express | |
| const cors = require('cors') | |
| const WebSocket = require('ws') | |
| const EventEmitter = require('events').EventEmitter | |
| require('dotenv').config() | |
| //Configure Transcription Request for Google Speech to Text | |
| const request = { | |
| config: { |
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
| import React, { useState, useEffect, useRef } from "react"; | |
| export default function App() { | |
| const [isActive, setIsActive] = useState(false); | |
| const [mediaStream, setMediaStream] = useState(null); | |
| const [userFacing, setuserFacing] = useState(false); | |
| const [videoUrl, setvideoUrl] = useState(""); | |
| const [chunks, setchunks] = useState([]); | |
| const videoRef = useRef(); |