Skip to content

Commit e6535f8

Browse files
committed
fixes an enqueu issue and updated the doc
1 parent 2e6a109 commit e6535f8

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

README.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ The code adds all videos to the playlist, in declaration order. After the `for`
4949
video (`BadWeather`) is displayed in the paused state, but you may not notice that since there is
5050
no sleep before the play command is called. Then the whole thing is played in that sequence:
5151

52-
1. The `BadWeather` video is played for 25 seconds.
53-
2. Activate the repeat mode for the video that is actually running.
52+
1. The `BadWeather` video starts.
53+
2. Activate the repeat mode.
5454
3. Sleep 25 seconds. Since `BadWather` is only 20 seconds long, it will repeat and play for another 5 seconds.
5555
4. The `Tornado` video starts.
5656
5. Turn off video repetion.
@@ -68,5 +68,11 @@ From there, you got the gist of it. You could as well repeat the whole sequence
6868
into a while loop instead of closing. You could aso leave the `CropField` video run indefinitely
6969
or until a given event.
7070

71+
You can also call `player.exec()` to execute any rc command that is not implemented right away. If
72+
you think that there is some other good abstraction to add to the player, feel free to implement
73+
that function send a pull request my way! Want to make it work under another OS? Don't ask me
74+
what I can do for you, ask yourself what you can do to make it happend... and send me a pull
75+
request with your own cross platform implemetation!
76+
7177
I developped this module after the OMX Player deprecation for my escape games consulting work.
7278
Tested and working on Raspberry PI 4 with the minimal Raspbian image (console only).

lib/index.mjs

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class VlcPlayer {
2020

2121
/**
2222
* Open the VLC media player with an empty playlist. VLC will not take
23-
* over the display until the first media is enqueueed to the playlist.
23+
* over the display until the first media is added to the playlist.
2424
*/
2525
async open() {
2626
return new Promise((resolve, reject) => {
@@ -44,9 +44,9 @@ export class VlcPlayer {
4444
}
4545

4646
/**
47-
* Start playing after being paused or enqueue the given file at the end of
48-
* the playlist and start playing it. If the file is already in the
49-
* playlist, jump to that media position in the playlist instead.
47+
* Start playing after being paused or enqueue the given file at the end
48+
* of the playlist. If the file is already in the playlist, jump to that
49+
* media position in the playlist instead.
5050
*
5151
* @param {string=} mediaPath - If unspecified, resumes the running video. If a valid media path is specified, start playing that media.
5252
*/
@@ -56,7 +56,7 @@ export class VlcPlayer {
5656
}
5757
else {
5858
if (!this._playlist.has(mediaPath)) {
59-
await this.enqueue(mediaPath);
59+
await this.add(mediaPath);
6060
}
6161
let index = this._playlist.get(mediaPath);
6262
await this.exec(`goto ${index}`);
@@ -71,7 +71,7 @@ export class VlcPlayer {
7171
}
7272

7373
/**
74-
* Enqueue the specified media at the end of the playlist.
74+
* Add the specified media at the end of the playlist.
7575
*
7676
* @param {string} mediaPath The path of the media to play.
7777
*/
@@ -121,7 +121,7 @@ export class VlcPlayer {
121121
* @param {string} command - The command to execute.
122122
*/
123123
exec(command) {
124-
return new Promise((resolve, reject) => {
124+
return new Promise((resolve, reject) => {
125125
if (!command) {
126126
return reject("The command parameter must be provided.");
127127
}

0 commit comments

Comments
 (0)