source: main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components/AudioTimeBar.vue@ 35432

Last change on this file since 35432 was 35430, checked in by cstephen, 3 years ago

Add audio length to playback state.
Disable audio time bar when irrelevant.

File size: 1.1 KB
Line 
1<template>
2<div class="root">
3 <input type="range" class="slider-continuous" v-model.number="sliderValue" :max="audioLength" step="0.01" :disabled="isDisabled" />
4 <span>{{ stringSliderValue }}</span>
5</div>
6</template>
7
8<style lang="scss" scoped>
9.root {
10 display: flex;
11 align-items: center;
12 gap: 1em;
13}
14</style>
15
16<script>
17import Util from "../js/Util"
18
19export default {
20 name: "AudioTimeBar",
21 props: {
22 modelValue: Number,
23 audioLength: Number,
24 isDisabled: Boolean
25 },
26 emits: [ "update:modelValue" ],
27 computed: {
28 sliderValue: {
29 get() {
30 if (this.modelValue < 0 || this.isDisabled) {
31 return 0;
32 }
33
34 if (this.modelValue > this.audioLength) {
35 return this.audioLength;
36 }
37
38 return this.modelValue;
39 },
40 set(newValue) {
41 this.$emit("update:modelValue", newValue);
42 }
43 },
44 stringSliderValue() {
45 return Util.formatSecondsTimeString(this.sliderValue, false, 2);
46 }
47 }
48}
49</script>
Note: See TracBrowser for help on using the repository browser.