View zpix-conversion.js
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
zpix('event', 'purchaseConversion', { | |
discountCode: '19ninepod', // <-- Replace this value with the show's slug from the URL | |
}); |
View gist:70f49a53502d2ae40e1eeea063546f05
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
66.249.83.101 - New pixel conversion {"id":"64232c61eaee015ea8f900cb","uid":"1-8jmqul3c-lh8mm2av","eventName":"purchaseConversion","eventData":"{\"purchasePrice\":\"1.00\",\"currency\":\"USD\",\"discountCode\":\"NONE\",\"order\":\"undefined\",\"customerId\":\"0\",\"newCustomer\":true}","version":"1","documentLocation":"https://gtm-msr.appspot.com/render2?id=GTM-HQ4K","referrerLocation":"https://gtm-msr.appspot.com/render?id=GTM-HQ4K","timestamp":"1683174456432","documentEncoding":"UTF-8","screenResolution":"1366x768","viewportResolution":"1366x768","colorDepth":"24","documentTitle":"gtm-msr","browserName":"Chrome 111","isMobile":"false","browserUserAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36","browserTimezone":"300","utm_source":"","utm_medium":"","utm_term":"","utm_content":"","utm_campaign":"","utm_source_platform":"","utm_creative_format":"","utm_marketing_tactic":"","ipAddress":"66.249.83.101","userAgent":"Mozilla/5.0 (Windows N |
View useSpeechToText.ts
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 React from "react"; | |
import hark from "hark"; | |
import * as speech from "microsoft-cognitiveservices-speech-sdk"; | |
const AUDIO_SAMPLE_RATE = 48_000; | |
const BUFFER_SECONDS = 2; | |
const azureCredentials = { | |
token: "***********************", | |
region: "japaneast", |
View useSpeechToText.diff
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 BUFFER_SECONDS = 2; | |
export default function useSpeechToText( | |
speechToTextEnabled: boolean, | |
muted: boolean, | |
newMessage: (message: { text: string; isFinal: boolean }) => void, | |
) { | |
+ const bufferBlocks = React.useRef<{ duration: number; bytes: ArrayBufferLike }[]>([]); |
View useSpeechToText.diff
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
// Control the streaming flag, based on the voice activity detection (that uses hark) and the mute/unmute flag | |
React.useEffect(() => { | |
if (shouldStream) { | |
console.log("Voice activity detected, starting streaming current buffer + live streaming..."); | |
streamingFlagRef.current = true; | |
} else { | |
console.log("No voice activity detected, stopped streaming."); | |
+ const timeout = setTimeout(() => { | |
streamingFlagRef.current = false; | |
+ }, 2_000); |
View useSpeechToText.diff
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 mutedRef = React.useRef<boolean>(muted); | |
- | |
- // We use a ref to check if the microphone is muted or not, to avoid recreating | |
- // the Azure's SpeechRecognizer instance every time we mute/unmute. | |
- React.useEffect(() => { | |
- mutedRef.current = muted; | |
- }, [muted]); |
View useSpeechToText.ts
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 mutedRef = React.useRef<boolean>(muted); | |
// We use a ref to check if the microphone is muted or not, to avoid recreating | |
// the Azure's SpeechRecognizer instance every time we mute/unmute. | |
React.useEffect(() => { | |
mutedRef.current = muted; | |
}, [muted]); |
View useAudioActive.ts
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 { useEffect, useState } from "react"; | |
import hark from "hark"; | |
export function useAudioActive(stream: MediaStream | undefined) { | |
const [speakerActive, setSpeakerActive] = React.useState(false); | |
React.useEffect(() => { | |
if (!stream) { | |
setSpeakerActive(false); | |
return; |
View useSpeechToText.ts
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 React from "react"; | |
import hark from "hark"; | |
import * as speech from "microsoft-cognitiveservices-speech-sdk"; | |
const AUDIO_SAMPLE_RATE = 40_000; | |
const azureCredentials = { | |
token: "***********************", | |
region: "japaneast", | |
}; |
View index.tsx
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 React from "react"; | |
import ReactDOM from "react-dom"; | |
import useSpeechToText from "./utils/hooks/useSpeechToText"; | |
ReactDOM.render( | |
<React.StrictMode> | |
<TestApp /> | |
</React.StrictMode>, | |
document.getElementById("root"), | |
); |
NewerOlder