Discord bot wont play music

I made a discord bot thart play music and it works perfectly fine in the past few weeks but suddenly one day I tried to play a music and the bot joined the voice channel but it did not play any music. When I tried to log queue.isPlaying() into my console and it says true but it does not play any sound. The second thing is the bot will stay in the voice channel as long as the program is running even though I have leaveOnEnd = true for my bot. It seems like the bot is stuck in one place. If any one have done something similar with this, I would like to know what is the problem with this.

const { SlashCommandBuilder } = require("discord.js");
const { QueryType, useMainPlayer} = require("discord-player");

module.exports = {
    data: new SlashCommandBuilder()
        .setName("play")
        .setDescription("Play a song")
        .addStringOption(option => 
            option
                .setName('query')
                .setDescription('The music to search for')
                .setRequired(true)
        ),
    async execute(interaction) {
        await interaction.deferReply();

        const player = useMainPlayer();

        // Search for requested song
        const query = interaction.options.getString('query', true);
        await interaction.followUp({ content: `Loading: ${query}`});
        const searchResult = await player
            .search(query, {
                requestedBy: interaction.user,
                searchEngine: QueryType.AUTO
            })
            .then(x => x.tracks[0]);
        if(!searchResult) {
            await interaction.followUp({
                content: "No results were found!"
            });
        }

        try {
            const { track } = await player.play(interaction.member.voice.channel, query, {
                nodeOptions: {
                    metadata: {
                        channel: interaction.channel
                    },
                    volume: interaction.client.config.opt.volume,
                    leaveOnEmpty: interaction.client.config.opt.leaveOnEmpty,
                    leaveOnEmptyCooldown: interaction.client.config.opt.leaveOnEmptyCooldown,
                    leaveOnEnd: interaction.client.config.opt.leaveOnEnd,
                    leaveOnEndCooldown: interaction.client.config.opt.leaveOnEndCooldown,
                }
            });
            await interaction.followUp({ content: `Playing: **${track.description}**n${track.thumbnail}` });
        }catch(error) {
            console.log(`[ERROR] ${error}`);
            await interaction.followUp({ content: `Can't find song with name **${query}**`});
            return;
        }
    }
}

I thought it might be because dependencies are outdated and I tried to update all but it still does not work.

"dependencies": {
    "@discord-player/extractor": "^4.4.7",
    "@discordjs/voice": "^0.17.0",
    "discord-player": "^6.6.10",
    "discord.js": "^14.15.3",
    "ffmpeg": "^0.0.4",
    "fluent-ffmpeg": "^2.1.3",
    "mediaplex": "^0.0.9",
    "punycode.js": "^2.3.1",
    "ytdl-core": "^4.11.5"
  }