OK, did the same with 2 YT songs in the queue and single repeat on the first and indeed it jumped to the second. After the second it didn’t go back to the first.
With normal repeat on it does loop both songs in the queue.
OK, did the same with 2 YT songs in the queue and single repeat on the first and indeed it jumped to the second. After the second it didn’t go back to the first.
With normal repeat on it does loop both songs in the queue.
Not only for this plugin, but with my other plugins as well… Not surprising as they use more or less the same playback method.
I need time to identify the cause.
Cause identified. In statemachine.js
(yep, it’s statemachine again):
CoreStateMachine.prototype.syncState = function (stateService, sService) {
...
} else if (stateService.status === 'stop') {
if (this.currentStatus === 'play') {
// Service has stopped without client request, meaning it is finished playing its track block. Move on to next track block.
// this.currentPosition = stateService.position;
this.currentSeek = stateService.seek;
this.currentDuration = stateService.duration;
this.currentTrackType = null;
this.currentTitle = null;
this.currentArtist = null;
this.currentAlbum = null;
this.currentAlbumArt = '/albumart';
this.currentUri = stateService.uri;
this.currentSampleRate = null;
this.currentBitDepth = null;
this.currentChannels = null;
this.commandRouter.pushDebugConsoleMessage('CURRENT POSITION ' + this.currentPosition);
if (trackBlock !== undefined && trackBlock.service !== 'webradio') {
if (this.currentConsume !== undefined && this.currentConsume == true) {
this.playQueue.removeQueueItem(this.currentPosition);
} else {
if (this.currentRandom !== undefined && this.currentRandom === true) {
var nextSongIndex = 0;
/**
* Using nextRandomIndex because prefetch may have picked one sone randomly
* from another service (thus not prefetched). This way we use the same index
*/
if (this.nextRandomIndex) { this.currentPosition = this.nextRandomIndex; } else { this.currentPosition = this.randomQueue.next(); }
} else {
if (this.currentPosition == null || this.currentPosition === undefined) { this.currentPosition = 0; } else this.currentPosition++;
}
}
}
this.commandRouter.pushDebugConsoleMessage('CURRENT POSITION ' + this.currentPosition);
this.currentStatus = 'stop';
if (this.isConsume) {
this.consumeState.status = 'stop';
this.consumeState.seek = 0;
}
// Checking repeat status
if (this.currentRepeat && this.currentRepeatSingleSong) {
if (this.prefetchDone == false) {
this.play(this.currentPosition)
.then(self.pushState.bind(self))
.fail(this.pushError.bind(this));
this.askedForPrefetch = false;
this.simulateStopStartDone = false;
} else {
...
This part gets triggered when playback of a YT track stops. It reaches the following line, which increments the current queue position by 1 (currentPosition
):
if (this.currentPosition == null || this.currentPosition === undefined) { this.currentPosition = 0; } else this.currentPosition++;
Then, further down, it checks whether ‘repeat single song’ is enabled:
// Checking repeat status
if (this.currentRepeat && this.currentRepeatSingleSong) {
if (this.prefetchDone == false) {
this.play(this.currentPosition)
.then(self.pushState.bind(self))
.fail(this.pushError.bind(this));
...
This plugin doesn’t support prefetch, so statemachine plays currentPosition
. But currentPosition
has just been incremented, so the check for ‘repeat single song’ at this point is actually useless. It should perform this check before incrementing currentPosition
.
So the issue stems from statemachine
, not the plugin.
@SimonE @patrickkfkan
Thank you for your information. I have modified the statemachine.js by moving the block of checking repeat to before block of currentPosition increament and restart volumio then it can repeat a single song. I have not test other use cases, only one that in a queue of several songs with mixed local and youtube, i can loop a youtube song with when i set repeat icon with a ‘1’.
I attached my statemachine.js for other reference.
statemachine.zip (8.9 KB)
Thanks~
I am running vol 3.378_x86. I did make a secret and ID with the guide/google youtube api, but got error (no results) when I am yousung youtube2. Can not browse to my account.
Trying youtube 2 because cast plugin does not work with Fusion DSP
Long overdue update: v1.0.1, which you can find in the beta channel of plugin store.
To install from beta channel:
http://<volumio address>/dev
Like the YouTube Music plugin, this plugin uses a modified version of the YouTube.js library for content fetching and login. Credit goes to the developers of that library. If you like this plugin, consider sponsoring that project or giving it a star.
This is a major update which brings about the following changes (for better or worse - I hope better):
Hi @patrickkfkan,
Thanks for this update! I gave it a try yesterday on one of my pi’s and I like the simpler login and more access to library items like “Watch later”.
I mostly use your youtube2 plugin with auto play switched on and just use that to sometime discover new music.
So far, I’ve noticed with this update, there is a loop of the same two songs that would auto play back-to-back. this has happened a with a few different sets of songs and I’m not sure how to get out of the loop other than manually searching or choosing a new song. Then after a little while, a loop of two other songs will begin. See attached for screenshot of queue. Have you experienced this?
This is interesting. Does this happen regardless of where you are playing from (e.g. a playlist) or whether you are signed in?
Could you also PM me (don’t post here) the contents of http://<your volumio addr/dev
? If there are many entries under player queue, you can just send me the 5 entries before the repeating ones, as well as the first 5 repeating entries.
i think it stopped working the plugin with the google api. any idea?
Hi Giorgosperi,
I’m not clear what exactly you mean by saying “with the google api”, but perhaps it’s helpful for you: For me the plugin is working fine.
Regards Axel
hi, under youtube we can use the google api to login with our youtube account. it stopped working to me.
ok, thx. This does not apply to me because I do not have a youtube account.
But I’m curios, what’s the advantage if one has a youtube account and use the google api?
no problem. thanks also for your response. just i can find my liked videos and playlists that i do from an other device.
i think i figured it out. for some reason the api that i had its not working probably did records to the limit.
i added different api and it worked…
Plugin version 1.x no longer requires Google API credentials for signing into YT.
Updated v1.1.0:
The plugin has been recoded in TypeScript with the view of easier maintenance down the road. There may be regressions – if you come across any, please report them here.
v1.1.0 is currently in beta channel of Volumio plugin store. To install:
http://<volumio address>/dev
(All steps mandatory)
when i install the plugin, and go to settings my rpi4 freezes and upon reboot only gives me white screens. i cant acces anymore on browser only when i delete the folder in ssh and reboot it returns to normal state
It think it was just today that YouTube changed something that caused the underlying YouTube.js library to block the system process when trying to authenticate, making Volumio unresponsive. I have identified the cause and should be able to provide an update later in the day.
Updated v1.1.2, which addresses this:
For unfortunate souls who installed a previous version and now has an unresponsive Volumio, you can try the following:
ssh
into Volumio and run the following command to delete the youtube2
plugin folder, followed by restarting Volumio:rm -rf /data/plugins/music_service/youtube2
To install the updated plugin from beta channel:
http://<volumio address>/dev