Volume Slider UI component resets to max volume on resize
Vertana opened this issue · 2 comments
RIght now if you resize the window where it detects the mobile layout vs the desktop layout, the volume slider in the UI resets to max volume. This doesn't change the actual volume underneath, just the UI component. It probably needs to read lastVolume and set to that value on resize event.
This is happening because in track-controls.component.html when <div class="misc-controls" *ngIf="!isMobile">
is removed and renters the DOM as a result of isMobile toggling, the default value of 10 (see below) is applied to the volume slider. When you toggle mute you can observe the accurate volume reflected.
<mat-slider
#volume
class="volume-slider"
min="0"
max="10"
step=".1"
value="10"
(input)="changeVolume($event.value)"
>
</mat-slider>
I see why it’s happening, but I’m not the best at JS. I’m sure Angular has a global resize event, maybe just make the element read lastVolume on that? Would that override the html? Or maybe just take out the value assignment in html all together and set default value once in JavaScript on initialization? I’m not sure what the best answer is here.