retrouser955 / discord-player-youtubei

Super charging your bot. dpy is a tiny extractor module to test the validity of youtubei.js in discord-player version 7.
https://discord-player.js.org
Creative Commons Zero v1.0 Universal
25 stars 8 forks source link

The player does not start to play music #19

Closed boxeggg closed 3 months ago

boxeggg commented 3 months ago

Not consistently, the player does not play music and does not throwing any error

Discord-player debug: `Player debug event: Connecting to voice channel essa room (ID: ) Player debug event: Received play request from guild (ID: ) Player debug event: Requested option requires to play the track, initializing... Player debug event: Initiating stream extraction process... Player debug event: Executing onBeforeCreateStream hook (QueryType: youtubeVideo)... Player debug event: Failed to get stream from onBeforeCreateStream! Player debug event: Attempting to extract stream for Track { title: Papajak Watykaniak - Mroczny Rytuał Chuja, url: https://youtube.com/watch?v=14U1Fl5qQKQ } using registered extractors General player debug event: Executing extractor com.retrouser955.discord-player.discord-player-youtubei... General player debug event: Extractor com.retrouser955.discord-player.discord-player-youtubei executed successfully! Player debug event: Stream extraction was successful for Track { title: Papajak Watykaniak - Mroczny Rytuał Chuja, url: https://youtube.com/watch?v=14U1Fl5qQKQ } (Extractor: com.retrouser955.discord-player.discord-player-youtubei) Player debug event: Waiting for willPlayTrack event to resolve... Player debug event: Preparing final stream config: { "dispatcherConfig": { "disableBiquad": false, "disableEqualizer": false, "disableVolume": false, "disableFilters": false, "disableResampler": true, "sampleRate": 48000, "eq": [], "defaultFilters": [], "volume": 100, "data": { "id": "1269026540381802497", "title": "Papajak Watykaniak - Mroczny Rytuał Chuja", "description": "Papajak Watykaniak - Mroczny Rytuał Chuja by Wykopek2137", "author": "Wykopek2137", "url": "https://youtube.com/watch?v=14U1Fl5qQKQ", "thumbnail": "https://i.ytimg.com/vi/14U1Fl5qQKQ/hq720.jpg?sqp=-oaymwE2CNAFEJQDSFXyq4qpAygIARUAAIhCGAFwAcABBvABAfgB_gmAAtAFigIMCAAQARhlIFQoQjAP&rs=AOn4CLDaP2YTy1lxF531D9jGqRVV-rx0XQ", "duration": "04:55", "durationMS": 295000, "views": 5262, "requestedBy": null, "playlist": null }, "type": "raw", "skipFFmpeg": true }, "playerConfig": { "queue": false, "transitionMode": false, "seek": 0 } } Player debug event: Initiating DSP filters pipeline... Player debug event: Executing onAfterCreateStream hook... Player debug event: Preparing AudioResource... Player debug event: Initializing audio player... Player debug event: [NW] [WS] >> {"op":0,"d":{"server_id":"752593592706531521","user_id":"1052006621867417680","session_id":"d4fee4f0adec0cd0f3f11b11f69a40ef","token":"544c1cca6c5e34b5"}} Player debug event: [NW] state change: from {"code":0,"ws":true,"connectionOptions":{"endpoint":"frankfurt7537.discord.media:443","serverId":"752593592706531521","token":"","sessionId":"d4fee4f0adec0cd0f3f11b11f69a40ef","userId":"1052006621867417680"},"udp":false} to {"code":1,"ws":true,"connectionOptions":{"endpoint":"frankfurt7537.discord.media:443","serverId":"752593592706531521","token":"","sessionId":"d4fee4f0adec0cd0f3f11b11f69a40ef","userId":"1052006621867417680"},"udp":false} Player debug event: [NW] [WS] << {"op":8,"d":{"v":4,"heartbeat_interval":13750.0}} Player debug event: [NW] [WS] << {"op":2,"d":{"streams":[{"type":"video","ssrc":122031,"rtx_ssrc":122032,"rid":"","quality":0,"active":false}],"ssrc":122030,"port":50011,"modes":["aead_aes256_gcm_rtpsize","aead_aes256_gcm","aead_xchacha20_poly1305_rtpsize","xsalsa20_poly1305_lite_rtpsize","xsalsa20_poly1305_lite","xsalsa20_poly1305_suffix","xsalsa20_poly1305"],"ip":"66.22.243.23","experiments":["fixed_keyframe_interval"]}} Player debug event: [NW] state change: from {"code":1,"ws":true,"connectionOptions":{"endpoint":"frankfurt7537.discord.media:443","serverId":"752593592706531521","token":"544c1cca6c5e34b5","sessionId":"d4fee4f0adec0cd0f3f11b11f69a40ef","userId":"1052006621867417680"},"udp":false} to {"code":2,"ws":true,"connectionOptions":{"endpoint":"frankfurt7537.discord.media:443","serverId":"752593592706531521","token":"544c1cca6c5e34b5","sessionId":"d4fee4f0adec0cd0f3f11b11f69a40ef","userId":"1052006621867417680"},"udp":true,"connectionData":{"ssrc":122030}} Player debug event: [NW] [WS] << {"op":11,"d":{"user_ids":["505397083784740874","837075135151603751"]}} Player debug event: [NW] [WS] << {"op":18,"d":{"user_id":"505397083784740874","flags":2}} Player debug event: [NW] [WS] << {"op":18,"d":{"user_id":"837075135151603751","flags":2}} Player debug event: [NW] [WS] << {"op":20,"d":{"user_id":"505397083784740874","platform":0}} Player debug event: [NW] [WS] << {"op":20,"d":{"user_id":"837075135151603751","platform":0}} Player debug event: [NW] [WS] >> {"op":1,"d":{"protocol":"udp","data":{"address":"93.159.179.128","port":59624,"mode":"xsalsa20_poly1305_lite"}}} Player debug event: [NW] state change: from {"code":2,"ws":true,"connectionOptions":{"endpoint":"frankfurt7537.discord.media:443","serverId":"752593592706531521","token":"544c1cca6c5e34b5","sessionId":"d4fee4f0adec0cd0f3f11b11f69a40ef","userId":"1052006621867417680"},"udp":true,"connectionData":{"ssrc":122030}} to {"code":3,"ws":true,"connectionOptions":{"endpoint":"frankfurt7537.discord.media:443","serverId":"752593592706531521","token":"544c1cca6c5e34b5","sessionId":"d4fee4f0adec0cd0f3f11b11f69a40ef","userId":"1052006621867417680"},"udp":true,"connectionData":{"ssrc":122030}} Player debug event: [NW] [WS] << {"op":4,"d":{"video_codec":"H264","secure_frames_version":0,"secret_key":[198,96,171,34,163,170,236,49,110,118,32,233,48,35,159,4,117,110,94,71,207,97,122,90,62,220,134,195,117,247,83,213],"mode":"xsalsa20_poly1305_lite","media_session_id":"69656c70ea504d00281f9009fada4326","audio_codec":"opus"}} Player debug event: [NW] state change: from {"code":3,"ws":true,"connectionOptions":{"endpoint":"frankfurt7537.discord.media:443","serverId":"752593592706531521","token":"544c1cca6c5e34b5","sessionId":"d4fee4f0adec0cd0f3f11b11f69a40ef","userId":"1052006621867417680"},"udp":true,"connectionData":{"ssrc":122030}} to {"code":4,"ws":true,"connectionOptions":{"endpoint":"frankfurt7537.discord.media:443","serverId":"752593592706531521","token":"544c1cca6c5e34b5","sessionId":"d4fee4f0adec0cd0f3f11b11f69a40ef","userId":"1052006621867417680"},"udp":true,"connectionData":{"ssrc":122030,"encryptionMode":"xsalsa20_poly1305_lite","secretKey":{"0":198,"1":96,"2":171,"3":34,"4":163,"5":170,"6":236,"7":49,"8":110,"9":118,"10":32,"11":233,"12":48,"13":35,"14":159,"15":4,"16":117,"17":110,"18":94,"19":71,"20":207,"21":97,"22":122,"23":90,"24":62,"25":220,"26":134,"27":195,"28":117,"29":247,"30":83,"31":213},"sequence":14393,"timestamp":1281749318,"nonce":0,"nonceBuffer":{"type":"Buffer","data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},"speaking":false,"packetsPlayed":0}} Player debug event: state change: from {"status":"idle","resource":false,"stepTimeout":false} to {"status":"buffering","resource":true,"stepTimeout":false} Player debug event: Dispatching audio... General player debug event: [AsyncQueue] Releasing an entry from the queue... Player debug event: [NW] [WS] << {"op":5,"d":{"user_id":"837075135151603751","ssrc":119146,"speaking":1}} Player debug event: [NW] [WS] << {"op":5,"d":{"user_id":"505397083784740874","ssrc":117516,"speaking":1}} Player debug event: [NW] [WS] >> {"op":3,"d":1722629918962} Player debug event: [NW] [WS] << {"op":6,"d":1722629918962} General player debug event: [Lag Monitor] Event loop latency: 14.964500000001863ms Player debug event: [NW] [WS] >> {"op":3,"d":1722629932717} Player debug event: [NW] [WS] << {"op":6,"d":1722629932717} Player debug event: [NW] [WS] >> {"op":3,"d":1722629946472} Player debug event: [NW] [WS] << {"op":6,"d":1722629946472} General player debug event: [Lag Monitor] Event loop latency: 15.013099999996484ms Player debug event: [NW] [WS] >> {"op":3,"d":1722629960228} Player debug event: [NW] [WS] << {"op":6,"d":1722629960228} Player debug event: [NW] [WS] >> {"op":3,"d":1722629973989} Player debug event: [NW] [WS] << {"op":6,"d":1722629973989} Player debug event: [NW] [WS] >> {"op":3,"d":1722629987744} Player debug event: [NW] [WS] << {"op":6,"d":1722629987744}

retrouser955 commented 3 months ago

Please share your code such as your play command and how you register the extractors in the format like this ```js your code here ```

boxeggg commented 3 months ago

Register extractors executed on ready

async function loadExtractors() {
   await player.extractors.register(YoutubeiExtractor, {});
   await player.extractors.loadDefault((ext) => ext !== 'YouTubeExtractor');
}

Play command

let query = await player.search(interaction.options.getString("url", true));
const { track } = await player.play(channel, query, {
    nodeOptions: {
        metadata: interaction
    }
});
if (query.hasPlaylist()) {
    interaction.followUp(`**${query.playlist.title}** enqueued!`);
} else {
    interaction.followUp(`**${query.tracks[0].title}** enqueued!`);
}

Extractrors seems to load correctly

General player debug event: com.retrouser955.discord-player.discord-player-youtubei extractor loaded!
General player debug event: com.retrouser955.discord-player.discord-player-youtubei extractor activated!
General player debug event: com.discord-player.spotifyextractor extractor loaded!
General player debug event: com.discord-player.applemusicextractor extractor loaded!
General player debug event: com.discord-player.soundcloudextractor extractor loaded!
General player debug event: com.discord-player.vimeoextractor extractor loaded!
General player debug event: com.discord-player.reverbnationextractor extractor loaded!
General player debug event: com.discord-player.attachmentextractor extractor loaded!
General player debug event: com.discord-player.applemusicextractor extractor activated!
General player debug event: com.discord-player.soundcloudextractor extractor activated!
General player debug event: com.discord-player.vimeoextractor extractor activated!
General player debug event: com.discord-player.reverbnationextractor extractor activated!
General player debug event: com.discord-player.attachmentextractor extractor activated!

Cant tell why some requests work correctly some not, seems like some getting stucked on buffering

retrouser955 commented 3 months ago

image Hm weird. The track in the debug logs is working for me. This is my configuration

player.extractors.register(YoutubeiExtractor, {
   authentication: process.env.YOUTUBE_TOKEN || ""
})

You might be the victim of YouTube's A/B testing. Try logging in

retrouser955 commented 3 months ago

Could you send your deps? Copy pasting the package.json will do.

boxeggg commented 3 months ago
├── @discordjs/builders@1.8.2
├── @discordjs/rest@2.3.0
├── @discordjs/voice@0.17.0
├── axios@1.7.3
├── discord-player-youtubei@1.2.4
├── discord-player@6.7.1
├── discord.js@14.15.3
├── dotenv@16.4.5
├── ffmpeg-static@5.2.0
└── mediaplex@0.0.9
jay194 commented 3 months ago

Hello, I am also having issues just today. I had a bot running in an Ec2 instance and was working fine on version 1.0.9 of discord-player-youtubei. I ran the bot in my local env to test some things and audio was not playing. I pushed code to my Ec2 instance and restarted the bot and suddenly it stopped playing audio there like my local. Not sure if its the same issue here or not.

retrouser955 commented 3 months ago

Seems like youtube is quietly returning no streams. I am going to investigate this.

For now, please try using the ANDROID or iOS clients in the useClient option

player.extractors.register(YoutubeiExtractor, {
   streamOptions: {
      useClient: "ANDROID"
   }
})

Additionally, for live support using the ANDROID client, you can use the latest beta version. (npm i discord-player-youtubei@beta)

retrouser955 commented 3 months ago

Seems like YouTube is now A/B testing even on logged in accounts. Try using a different account.

mattpsvreis commented 3 months ago

Same issue on my end. This is my repo: https://github.com/mattpsvreis/DarkDJ

retrouser955 commented 3 months ago

@mattpsvreis please try what is mentioned above. From now on, just thumbsup the original comment if you are having the same issue.

retrouser955 commented 3 months ago

Related #20

retrouser955 commented 3 months ago

fixed in the latest patch