Changeset 35430


Ignore:
Timestamp:
2021-09-20T11:27:26+12:00 (3 years ago)
Author:
cstephen
Message:

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

Location:
main/trunk/model-interfaces-dev/atea/korero-maori-asr/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/App.vue

    r35429 r35430  
    8282            this.player.currentTime = playbackTime;
    8383            await this.player.play();
     84
     85            this.playbackState.length = this.player.duration;
    8486        }//,
    8587        // shouldPlayAudio(newValue) {
  • main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components/AudioTimeBar.vue

    r35426 r35430  
    11<template>
    22<div class="root">
    3     <input type="range" class="slider-continuous" v-model.number="sliderValue" :max="audioLength" step="0.01" />
     3    <input type="range" class="slider-continuous" v-model.number="sliderValue" :max="audioLength" step="0.01" :disabled="isDisabled" />
    44    <span>{{ stringSliderValue }}</span>
    55</div>
     
    2121    props: {
    2222        modelValue: Number,
    23         audioLength: Number
     23        audioLength: Number,
     24        isDisabled: Boolean
    2425    },
    2526    emits: [ "update:modelValue" ],
    26     data() {
    27         return {
    28             myValue: 0
    29         }
    30     },
    3127    computed: {
    3228        sliderValue: {
    3329            get() {
    34                 if (this.modelValue < 0) {
     30                if (this.modelValue < 0 || this.isDisabled) {
    3531                    return 0;
    3632                }
     
    4339            },
    4440            set(newValue) {
    45                 // this.myValue = newValue;
    4641                this.$emit("update:modelValue", newValue);
    4742            }
  • main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/components/TranscriptionItemEditor.vue

    r35426 r35430  
    22<div>
    33    <div class="editor-controls">
    4         <audio-time-bar v-model.number="currentPlaybackTime" :audio-length="2" />
     4        <audio-time-bar v-model.number="currentPlaybackTime" :audio-length="playbackState.length" :isDisabled="playbackState.id != transcription.id" />
    55
    66        <toggle-button v-model="enableEditing">
  • main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/main.js

    r35426 r35430  
    3535     * @param {String} id The ID of the transcription for which audio is being played.
    3636     * @param {Boolean} isPlaying A value indicating if audio is currently being played.
    37      * @param {Numbe} currentTime The current time in the audio playback.
     37     * @param {Number} currentTime The current time in the audio playback.
     38     * @param {Number} length The length of the audio track.
    3839     */
    39     constructor(id = "", isPlaying = false, currentTime = 0) {
     40    constructor(id = "", isPlaying = false, currentTime = 0, length = 0) {
    4041        /** @type {String} The ID of the transcription for which audio is currently being played. */
    4142        this.id = id;
     
    4647        /** @type {Number} Gets the current time in the playback. */
    4748        this.currentTime = currentTime;
     49
     50        /** @type {Number} Gets the length of the current audio track. */
     51        this.length = length;
    4852    }
    4953}
  • main/trunk/model-interfaces-dev/atea/korero-maori-asr/src/styles/_material.scss

    r35429 r35430  
    258258    cursor: pointer;
    259259
    260     background: var(--primary-bg-color);
     260    background-color: var(--primary-bg-color);
    261261    box-shadow: var(--primary-box-shadow-thin);
    262262
    263263    &:hover {
    264264        filter: brightness(var(--hover-brightness));
    265         }
     265    }
     266}
     267
     268@mixin disabled-slider-thumb {
     269    cursor: default;
     270   
     271    &:hover {
     272        filter: none;
     273    }
    266274}
    267275
     
    273281    height: 8px;
    274282    border-radius: 4px;
    275     background: scale-color($primary-bg-color-l1, $alpha: -70%);
     283    background-color: scale-color($primary-bg-color-l1, $alpha: -70%);
    276284
    277285    transition-duration: var(--transition-duration);
     
    290298
    291299    &:hover {
    292         background: scale-color($primary-bg-color-l1, $alpha: -60%);
     300        background-color: scale-color($primary-bg-color-l1, $alpha: -60%);
     301    }
     302}
     303
     304.slider-continuous:disabled {
     305    filter: grayscale(100%);
     306       
     307    &::-webkit-slider-thumb {
     308        @include disabled-slider-thumb();
     309    }
     310
     311    &::-moz-range-thumb {
     312        @include disabled-slider-thumb();
     313    }
     314
     315    &::-ms-thumb {
     316        @include disabled-slider-thumb();
     317    }
     318
     319    &:hover {
     320        background-color: scale-color($primary-bg-color-l1, $alpha: -70%);
    293321    }
    294322}
Note: See TracChangeset for help on using the changeset viewer.