GithubHelp home page GithubHelp logo

davidzeng0 / yasha Goto Github PK

View Code? Open in Web Editor NEW
19.0 3.0 7.0 229 KB

Audio Player Interface for Discord.js. Future development moved to https://github.com/davidzeng0/ying-client-node

License: MIT License

JavaScript 100.00%

yasha's People

Contributors

andrew101sanders avatar davidzeng0 avatar eliyya avatar geoxor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

yasha's Issues

Local files support

Hello,
I have a sound pad bot that plays a lot of audio files directly from disk to reduce load times. Is it possible to implement local files support or is there already a way to do it?
Thank you!

Possible memory leak

After a few days of playing audio files, it seems like the memory isn't getting released back to the system at all. The rss value increases over time and never goes down.

Things I tried while debugging:

  • Waiting for the garbage collector to kick in.
  • Using the --expose-gc flag and calling global.gc() after destroying the player.
  • Using the example code to make sure it's not an issue with my code.

This also seems to be happening with EarTensifier bot as the rss is 2x the heapUsed which is a lot compared to the initial boot values.

I/O Error during YouTube playback

Since some days, an IO Error occurs while playing songs from YouTube.

/app # node test.js 
[Error: I/O error]

Test script:

const { Client, GatewayIntentBits } = require('discord.js');
const { TrackPlayer, VoiceConnection, Source } = require('yasha');

(async () => {
  const client = new Client({
      intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildVoiceStates,
        GatewayIntentBits.GuildModeration,
        GatewayIntentBits.GuildMembers,
      ],
  });
  await client.login('DISCORD_BOT_TOKEN');

  const channel = await client.channels.fetch('VOICE_CHANNEL_ID');

  var player = new TrackPlayer();
  player.on("error", console.error);
  var track = await Source.resolve('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
  var connection = await VoiceConnection.connect(channel);

  var subscription = connection.subscribe(player);

  player.play(track);
  player.start();
})()

I'm testing this on WSL2 with Debian unstable inside a Docker container, this worked fine for several months. This is my Dockerfile:

FROM alpine:3.18 AS protoc-js

WORKDIR /tmp

RUN echo "@edge-testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
 && apk add --no-cache \
    bazel5@edge-testing \
    build-base \
    git \
 && git clone --branch v3.21.2 https://github.com/protocolbuffers/protobuf-javascript \
 && cd protobuf-javascript \
 && bazel build plugin_files \
 && install -o root -g root -m 0755 bazel-bin/generator/protoc-gen-js -t /tmp


FROM node:20.3-alpine AS base

RUN mkdir /app
WORKDIR /app

################################################################################
FROM base AS development

COPY --from=protoc-js /tmp/protoc-gen-js /usr/local/bin

ENV PYTHONUNBUFFERED=1
RUN apk add --no-cache --virtual .build-deps pango-dev jpeg-dev build-base cairo-dev giflib-dev python3 libsodium-dev libtool cmake g++ gcc ffmpeg-dev make git autoconf automake opus-dev libuv-dev protoc msttcorefonts-installer \
 && ln -sf python3 /usr/bin/python \
 && python3 -m ensurepip \
 && pip3 install --no-cache --upgrade pip setuptools

USER node

Log with strace: https://pastebin.com/szVcRfaF

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.