Browse Source

feat(EditSong): Added basic select player track position functionality

Owen Diffey 3 years ago
parent
commit
5efc7fb223
1 changed files with 15 additions and 0 deletions
  1. 15 0
      frontend/src/components/modals/EditSong/index.vue

+ 15 - 0
frontend/src/components/modals/EditSong/index.vue

@@ -47,7 +47,12 @@
 								v-show="!youtubeError"
 								height="20"
 								width="530"
+								@click="setTrackPosition($event)"
 							/>
+							<div id="playerTrack">
+								<div class="skip-duration"></div>
+								<div class="real-duration"></div>
+							</div>
 							<div class="player-footer">
 								<div class="player-footer-left">
 									<button
@@ -1664,6 +1669,16 @@ export default {
 			ctx.fillStyle = currentDurationColor;
 			ctx.fillRect(widthCurrentTime, 0, 1, 20);
 		},
+		setTrackPosition(event) {
+			this.seekTo(
+				Number(
+					Number(this.video.player.getDuration()) *
+						((event.pageX -
+							event.target.getBoundingClientRect().left) /
+							530)
+				)
+			);
+		},
 		toggleGenreHelper() {
 			this.$refs.genreHelper.toggleBox();
 		},