Skip to content
This repository was archived by the owner on Jul 12, 2023. It is now read-only.
This repository was archived by the owner on Jul 12, 2023. It is now read-only.

Unable to create oggStream #210

@Yvtq8K3n

Description

@Yvtq8K3n
member.guild.channels.cache.get(voiceChannel.id).members.forEach((tempMember) => {
                const filename = './recordings/${Date.now()}-${tempMember.id}.ogg';

                const opusStream = receiver.subscribe(tempMember.id, {
                    end: {
                      behavior: EndBehaviorType.AfterSilence,
                      duration: 100,
                    },
                  });
         
                //const rawAudio = opusStream.pipe(new opus.Decoder({ frameSize: 960, channels: 2, rate: 48000 }));
                
                const oggStream = new opus.OggLogicalBitstream({
                    opusHead: new opus.OpusHead({
                        channelCount: 2,
                        sampleRate: 48000,
                    }),
                    opusTags: new opus.OpusTags({
                        maxPackets: 10,
                    })
                });
                
                
                const out = fs.createWriteStream(filename);

                pipeline(opusStream, oggStream, out,  (err) => {
                    console.log(err);
                    if (err) {
                        console.warn('❌ Error recording file ${filename} - ${err.message}');
                    } else {
                        console.log('✅ Recorded ${filename}');
                    }
                });
            });
        }

TypeError: failed to downcast any to number
at crc (C:\Users\Yvtq8\Desktop\SideProjects\BobbyMcLovin\node_modules\node-crc\lib\lib.js:11:17)
at OggLogicalBitstream.calculateCRC (C:\Users\Yvtq8\Desktop\SideProjects\BobbyMcLovin\node_modules\prism-media\dist\ogg\OggLogicalBitstream.js:92:23)
at OggLogicalBitstream.writePage (C:\Users\Yvtq8\Desktop\SideProjects\BobbyMcLovin\node_modules\prism-media\dist\ogg\OggLogicalBitstream.js:150:33)
at OggLogicalBitstream.writeHeaderPages (C:\Users\Yvtq8\Desktop\SideProjects\BobbyMcLovin\node_modules\prism-media\dist\ogg\OggLogicalBitstream.js:74:18)
at new OggLogicalBitstream (C:\Users\Yvtq8\Desktop\SideProjects\BobbyMcLovin\node_modules\prism-media\dist\opus\OggLogicalBitstream.js:16:14)
at C:\Users\Yvtq8\Desktop\SideProjects\BobbyMcLovin\index.js:51:35
at Map.forEach ()
at start (C:\Users\Yvtq8\Desktop\SideProjects\BobbyMcLovin\index.js:37:70)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions