DanTheGoodman
DanTheGoodman
Explore posts from servers
CDCloudflare Developers
Created by DanTheGoodman on 2/11/2025 in #workers-help
R2 `Provided readable stream must have a known length` from workers
oooh ill try that
6 replies
CDCloudflare Developers
Created by DanTheGoodman on 2/11/2025 in #workers-help
R2 `Provided readable stream must have a known length` from workers
seems this works for telling the length:
const { readable, writable } = new TransformStream<Uint8Array, Uint8Array>({
expectedLength: offsets.length * 32 + pendingMessages.length * 32,
})
const { readable, writable } = new TransformStream<Uint8Array, Uint8Array>({
expectedLength: offsets.length * 32 + pendingMessages.length * 32,
})
6 replies
CDCloudflare Developers
Created by DanTheGoodman on 2/11/2025 in #workers-help
R2 `Provided readable stream must have a known length` from workers
or if I can pre-calculate the size, can I somehow tell it that?
6 replies
CDCloudflare Developers
Created by DanTheGoodman on 2/11/2025 in #workers-help
R2 `Provided readable stream must have a known length` from workers
Even with the s3 api? S3 should support that iirc
6 replies
CDCloudflare Developers
Created by DanTheGoodman on 2/11/2025 in #workers-help
R2 `Provided readable stream must have a known length` from workers
this is a local test, so maybe you can't do this with local testing?
6 replies
CDCloudflare Developers
Created by DanTheGoodman on 2/9/2025 in #workers-help
Promise.withResolvers for workers?
I just ended up using the event emitter and promises to wait
2 replies
DIAdiscord.js - Imagine an app
Created by DanTheGoodman on 12/30/2024 in #djs-voice
Not emitting audio received from websocket (webm opus)
ok so it seems i had to start the discord bot first, then send audio, so the header frame for the audio was sent to discord
9 replies
DIAdiscord.js - Imagine an app
Created by DanTheGoodman on 12/30/2024 in #djs-voice
Not emitting audio received from websocket (webm opus)
I tried using
const resource = createAudioResource(
"https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3",
{
inputType: StreamType.Arbitrary,
}
)
const resource = createAudioResource(
"https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3",
{
inputType: StreamType.Arbitrary,
}
)
and confirmed that does play audio, so connection is fine
9 replies
DIAdiscord.js - Imagine an app
Created by DanTheGoodman on 12/30/2024 in #djs-voice
Not emitting audio received from websocket (webm opus)
my suspicion is that the resource is not getting audio from the Readable, because it sits buffering for so long
9 replies
DIAdiscord.js - Imagine an app
Created by DanTheGoodman on 12/30/2024 in #djs-voice
Not emitting audio received from websocket (webm opus)
I can also see that the read method is only being called once, and not again when I emit the event that it should be called again according to https://nodejs.org/api/stream.html#readablereadsize
9 replies
DIAdiscord.js - Imagine an app
Created by DanTheGoodman on 12/30/2024 in #djs-voice
Not emitting audio received from websocket (webm opus)
dependencies:
[08:42:59.931] DEBUG (17160): --------------------------------------------------
Core Dependencies
- @discordjs/voice: 0.16.1
- prism-media: 1.3.5

Opus Libraries
- @discordjs/opus: 0.9.0
- opusscript: not found

Encryption Libraries
- sodium-native: 4.3.1
- sodium: not found
- libsodium-wrappers: 0.7.15
- tweetnacl: not found

FFmpeg
- version: 7.1
- libopus: yes
--------------------------------------------------
[08:42:59.931] DEBUG (17160): --------------------------------------------------
Core Dependencies
- @discordjs/voice: 0.16.1
- prism-media: 1.3.5

Opus Libraries
- @discordjs/opus: 0.9.0
- opusscript: not found

Encryption Libraries
- sodium-native: 4.3.1
- sodium: not found
- libsodium-wrappers: 0.7.15
- tweetnacl: not found

FFmpeg
- version: 7.1
- libopus: yes
--------------------------------------------------
9 replies
DIAdiscord.js - Imagine an app
Created by DanTheGoodman on 12/30/2024 in #djs-voice
Not emitting audio received from websocket (webm opus)
I can see in logs I am getting the data, and I do have the voicestates:
export const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates],
})
export const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates],
})
9 replies
DIAdiscord.js - Imagine an app
Created by DanTheGoodman on 12/30/2024 in #djs-voice
Not emitting audio received from websocket (webm opus)
const audioPlayer = createAudioPlayer({
behaviors: {
maxMissedFrames: 1000,
noSubscriber: NoSubscriberBehavior.Play,
},
})

const connection = joinVoiceChannel({
channelId: channel.id,
guildId: interaction.guildId!,
adapterCreator: channel.guild
.voiceAdapterCreator as DiscordGatewayAdapterCreator,
debug: true,
selfDeaf: false,
selfMute: false,
})

connection.on("stateChange", (oldState, newState) => {
logger.info(
`Connection transitioned from ${oldState.status} to ${newState.status}`
)
})

audioPlayer.on("stateChange", (oldState, newState) => {
logger.info(
`Audio player transitioned from ${oldState.status} to ${newState.status}`
)
})

let audioQueue: Buffer[] = []

const audioStream = new Readable({
read(size) {
console.log("read", size)
if (audioQueue.length > 0) {
logger.debug("sending audio data")
const chunk = audioQueue.shift()
return chunk
}
logger.debug("no audio data")
return null
},
})

emitter.on("audio", (audioData: AudioData) => {
audioQueue.push(audioData.audioBuffer)
audioStream.emit("readable", audioData.audioBuffer)
audioStream.emit("data", audioData.audioBuffer)
})

const resource = createAudioResource(audioStream, {
inputType: StreamType.WebmOpus,
inlineVolume: true,
})

audioPlayer.on("error", (error) => {
logger.error({ error }, "Error in audio player")
})

connection.on("error", (error) => {
logger.error({ error }, "Error in connection")
})

connection.subscribe(audioPlayer)

connection.on(VoiceConnectionStatus.Ready, () => {
logger.debug("Connection is ready, starting playback")
audioPlayer.play(resource)
})
const audioPlayer = createAudioPlayer({
behaviors: {
maxMissedFrames: 1000,
noSubscriber: NoSubscriberBehavior.Play,
},
})

const connection = joinVoiceChannel({
channelId: channel.id,
guildId: interaction.guildId!,
adapterCreator: channel.guild
.voiceAdapterCreator as DiscordGatewayAdapterCreator,
debug: true,
selfDeaf: false,
selfMute: false,
})

connection.on("stateChange", (oldState, newState) => {
logger.info(
`Connection transitioned from ${oldState.status} to ${newState.status}`
)
})

audioPlayer.on("stateChange", (oldState, newState) => {
logger.info(
`Audio player transitioned from ${oldState.status} to ${newState.status}`
)
})

let audioQueue: Buffer[] = []

const audioStream = new Readable({
read(size) {
console.log("read", size)
if (audioQueue.length > 0) {
logger.debug("sending audio data")
const chunk = audioQueue.shift()
return chunk
}
logger.debug("no audio data")
return null
},
})

emitter.on("audio", (audioData: AudioData) => {
audioQueue.push(audioData.audioBuffer)
audioStream.emit("readable", audioData.audioBuffer)
audioStream.emit("data", audioData.audioBuffer)
})

const resource = createAudioResource(audioStream, {
inputType: StreamType.WebmOpus,
inlineVolume: true,
})

audioPlayer.on("error", (error) => {
logger.error({ error }, "Error in audio player")
})

connection.on("error", (error) => {
logger.error({ error }, "Error in connection")
})

connection.subscribe(audioPlayer)

connection.on(VoiceConnectionStatus.Ready, () => {
logger.debug("Connection is ready, starting playback")
audioPlayer.play(resource)
})
9 replies
CDCloudflare Developers
Created by Walshy on 9/26/2024 in #workers-and-pages-discussions
Workers should be fine - got anymore
even other workers with different names?
51 replies
CDCloudflare Developers
Created by Walshy on 9/26/2024 in #workers-and-pages-discussions
Workers should be fine - got anymore
@Walshy | Deploying when will other services be automatically fixed? Or should I just start rdeploying everyhting? We have a fair few
51 replies
CDCloudflare Developers
Created by Walshy on 9/26/2024 in #workers-and-pages-discussions
Workers should be fine - got anymore
yep, errors just went to 0 lol
51 replies