Skip to content

Commit e28db8e

Browse files
committed
feat: failed attempt to add volume slider in popover based on device
1 parent 8207899 commit e28db8e

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

resources/js/components/video/VideoPlayer.vue

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ defineExpose({
11041104
</div> -->
11051105
</section>
11061106
<VideoPopover
1107-
popoverClass="!max-w-40 rounded-lg h-16 md:h-fit font-mono"
1107+
popoverClass="!max-w-40 rounded-lg h-20 md:h-fit font-mono"
11081108
ref="popover"
11091109
:margin="80"
11101110
:player="player ?? undefined"
@@ -1117,9 +1117,9 @@ defineExpose({
11171117
<section class="flex flex-col text-xs h-16 md:h-fit overflow-y-auto scrollbar-minimal transition-transform">
11181118
<VideoPopoverItem v-for="(item, index) in videoPopoverItems" :key="index" v-bind="item" />
11191119
<VideoPopoverSlider
1120+
v-model="currentSpeed"
11201121
:text="`Speed`"
11211122
:shortcut="`${Math.round(currentSpeed * 100)}%`"
1122-
v-model="currentSpeed"
11231123
:icon="CircumTimer"
11241124
:min="playbackMin"
11251125
:max="playbackMax"
@@ -1128,6 +1128,19 @@ defineExpose({
11281128
:wheel-action="handleSpeedWheel"
11291129
:title="'Change Playback Speed'"
11301130
/>
1131+
<VideoPopoverSlider
1132+
v-model="currentVolume"
1133+
:hidden="true"
1134+
:text="`Volume`"
1135+
:shortcut="`${Math.round(currentVolume * 100)}%`"
1136+
:icon="currentVolume > 0.3 ? ProiconsVolume : currentVolume > 0 ? ProiconsVolumeLow : ProiconsVolumeMute"
1137+
:min="0"
1138+
:max="1"
1139+
:step="0.05"
1140+
:action="() => handleVolumeChange()"
1141+
:wheel-action="handleVolumeWheel"
1142+
:title="'Change Volume'"
1143+
/>
11311144
</section>
11321145
</template>
11331146
</VideoPopover>

resources/js/service/util.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ export function getScreenSize(): 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'default' {
153153
return 'default';
154154
}
155155

156+
export function isMobileDevice(): boolean {
157+
const mediaQuery = window.matchMedia('(hover: none) and (pointer: coarse), (max-width: 768px)');
158+
159+
return mediaQuery.matches;
160+
}
161+
156162
/**
157163
* Converts a numerical file size in bytes to a human readable format in the largest applicable unit.
158164
*

resources/js/types/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ export interface PopoverSlider {
198198
wheelAction?: (event: WheelEvent) => void;
199199
style?: string;
200200
disabled?: boolean;
201+
hidden?: boolean;
201202
icon?: Component;
202203
min?: number;
203204
max?: number;

0 commit comments

Comments
 (0)