Explorar o código

feat(SoundcloudPlayer): Play track on setting of track position

Owen Diffey hai 1 ano
pai
achega
fd158f17fc
Modificáronse 1 ficheiros con 15 adicións e 14 borrados
  1. 15 14
      frontend/src/components/SoundcloudPlayer.vue

+ 15 - 14
frontend/src/components/SoundcloudPlayer.vue

@@ -69,20 +69,6 @@ const playerVolumeControlIcon = computed(() => {
 
 const soundcloudTrackId = computed(() => props.song.mediaSource.split(":")[1]);
 
-const playerSetTrackPosition = event => {
-	console.debug(TAG, "PLAYER SET TRACK POSITION");
-
-	soundcloudGetDuration(duration => {
-		soundcloudSeekTo(
-			Number(
-				Number(duration / 1000) *
-					((event.pageX - event.target.getBoundingClientRect().left) /
-						canvasWidth.value)
-			) * 1000
-		);
-	});
-};
-
 const playerPlay = () => {
 	console.debug(TAG, "PLAYER PLAY");
 
@@ -108,6 +94,21 @@ const playerHardStop = () => {
 	playerStop();
 };
 
+const playerSetTrackPosition = event => {
+	console.debug(TAG, "PLAYER SET TRACK POSITION");
+
+	playerPlay();
+	soundcloudGetDuration(duration => {
+		soundcloudSeekTo(
+			Number(
+				Number(duration / 1000) *
+					((event.pageX - event.target.getBoundingClientRect().left) /
+						canvasWidth.value)
+			) * 1000
+		);
+	});
+};
+
 const playerToggleMute = () => {
 	console.debug(TAG, "PLAYER TOGGLE MUTE");