Browse Source

Fix audio playlist order

master
Eduard Kuzmenko 2 years ago
parent
commit
f5552a4cc3
  1. 32
      src/components/appMediaPlaybackController.ts
  2. 8
      src/helpers/searchListLoader.ts
  3. 2
      src/scss/partials/_ckin.scss

32
src/components/appMediaPlaybackController.ts

@ -584,23 +584,29 @@ export class AppMediaPlaybackController extends EventListenerBase<{
const listLoader = this.listLoader; const listLoader = this.listLoader;
const current = listLoader.getCurrent(); const current = listLoader.getCurrent();
if(!current || !verify(current)) { if(!current || !verify(current)) {
const previous = listLoader.getPrevious();
let idx = previous.findIndex(verify);
let jumpLength: number; let jumpLength: number;
if(idx !== -1) {
jumpLength = -(previous.length - idx); for(const withOtherSide of [false, true]) {
} else { const previous = listLoader.getPrevious(withOtherSide);
idx = listLoader.getNext().findIndex(verify);
let idx = previous.findIndex(verify);
if(idx !== -1) { if(idx !== -1) {
jumpLength = idx + 1; jumpLength = -(previous.length - idx);
} else {
const next = listLoader.getNext(withOtherSide);
idx = next.findIndex(verify);
if(idx !== -1) {
jumpLength = idx + 1;
}
}
if(jumpLength !== undefined) {
break;
} }
} }
if(idx !== -1) { if(jumpLength) {
if(jumpLength) { this.go(jumpLength, false);
this.go(jumpLength, false);
}
} else { } else {
this.setTargets({peerId, mid}); this.setTargets({peerId, mid});
} }
@ -645,7 +651,7 @@ export class AppMediaPlaybackController extends EventListenerBase<{
const listLoader = this.listLoader; const listLoader = this.listLoader;
if(this.lockedSwitchers || if(this.lockedSwitchers ||
(!this.round && listLoader.current && !listLoader.next.length) || (!this.round && listLoader.current && !listLoader.next.length) ||
!listLoader.getNext().length || !listLoader.getNext(true).length ||
!this.next()) { !this.next()) {
this.stop(); this.stop();
this.dispatchEvent('stop'); this.dispatchEvent('stop');

8
src/helpers/searchListLoader.ts

@ -191,20 +191,20 @@ export default class SearchListLoader<Item extends {mid: number, peerId: PeerId}
} }
} }
public getPrevious() { public getPrevious(withOtherSide?: boolean) {
let previous = this.previous; let previous = this.previous;
if(this.otherSideLoader) { if(this.otherSideLoader && withOtherSide) {
previous = previous.concat(this.otherSideLoader.previous); previous = previous.concat(this.otherSideLoader.previous);
} }
return previous; return previous;
} }
public getNext() { public getNext(withOtherSide?: boolean) {
let next = this.next; let next = this.next;
if(this.otherSideLoader) { if(this.otherSideLoader && withOtherSide) {
next = next.concat(this.otherSideLoader.next); next = next.concat(this.otherSideLoader.next);
} }

2
src/scss/partials/_ckin.scss

@ -388,7 +388,7 @@ video::-webkit-media-controls-enclosure {
} }
&.is-focused .progress-line__filled:not(.progress-line__loaded):after { &.is-focused .progress-line__filled:not(.progress-line__loaded):after {
transform: translateX(calc(var(--thumb-size) / 2)) scale(1.25); transform: translateX(calc(var(--thumb-size) / 2)) scale(1.125);
} }
&__loaded, &:before { &__loaded, &:before {

Loading…
Cancel
Save