Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

av.Player constructor lock the program #28

Open
eledwinn opened this issue Sep 28, 2020 · 2 comments
Open

av.Player constructor lock the program #28

eledwinn opened this issue Sep 28, 2020 · 2 comments

Comments

@eledwinn
Copy link

Hi, i have problems when try play mp3 from my tessel 2.

When i run next code, this is blocked when av.Player() is called.

'use strict';
const path = require('path');
const av = require('tessel-av');
const mp3 = path.join(__dirname, '20-second-nonsense.mp3');
console.log('one'); // this is showed in console
const sound = new av.Player(mp3);
console.log('two'); // this never show in console
sound.play();

sound.on('timeupdate', function(seconds) {
  seconds = Math.round(seconds);

  if (seconds === 2) {
    this.pause();
  }

  if (seconds > 12) {
    this.stop().play();
  }
});

sound.on('pause', function() {
  setTimeout(() => this.play(10), 1000);
});

My environment info:

(base) MacBook-Pro:audio edwingomez$ t2 version
INFO Looking for your Tessel...
INFO Connected to Tessel-02A37EC93AD1.
INFO Tessel Environment Versions:
INFO t2-cli: 0.1.23
INFO t2-firmware: 0.2.0
INFO Node.js: 8.11.3

(base) MacBook-Pro:audio edwingomez$ node -v
v10.16.0

My package.json

{
  "name": "audio",
  "version": "0.0.0",
  "description": "Tessel project",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": "www.github.com/tessel/t2-cli",
  "keywords": [
    "Tessel"
  ],
  "license": "MIT",
  "readme": "A bare bones Tessel 2 blinky script.",
  "dependencies": {
    "tessel-av": "^0.19.0"
  }
}
@HipsterBrown
Copy link
Contributor

Hi @eledwinn, do you have a .tesselinclude file in your project directory to include your mp3 file in the files pushed to your Tessel? https://tessel.gitbooks.io/t2-docs/content/API/CLI.html#project-files

@eledwinn
Copy link
Author

Hi @HipsterBrown, yes, i'm using .tesselinclude such as show CLI documentation.
I'm pushed my code to github for illustrate.
https://github.com/eledwinn/tessel-tests/tree/master/audio

I tried creating the new Player() instance without parameters, but it also lock there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants