origam 2.38.0 → 2.38.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/dist/src/assets/locales/en.json +1 -1
- package/dist/src/assets/locales/fr.json +2 -2
- package/dist/src/components/Alert/OrigamAlert.vue +739 -165
- package/dist/src/components/App/OrigamApp.vue +95 -19
- package/dist/src/components/App/OrigamAppBar.vue +751 -158
- package/dist/src/components/Audio/OrigamAudio.vue +1288 -346
- package/dist/src/components/Audio/OrigamAudioWaveform.vue +63 -7
- package/dist/src/components/Avatar/OrigamAvatar.vue +678 -126
- package/dist/src/components/Avatar/OrigamAvatarGroup.vue +700 -153
- package/dist/src/components/Badge/OrigamBadge.vue +548 -135
- package/dist/src/components/Blockquote/OrigamBlockquote.vue +698 -140
- package/dist/src/components/BottomNav/OrigamBottomNav.vue +864 -156
- package/dist/src/components/Bracket/OrigamBracket.vue +1013 -380
- package/dist/src/components/Bracket/OrigamBracketCompetitor.vue +674 -154
- package/dist/src/components/Bracket/OrigamBracketMatch.vue +663 -163
- package/dist/src/components/Bracket/OrigamBracketRound.vue +116 -34
- package/dist/src/components/Breadcrumb/OrigamBreadcrumb.vue +654 -119
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbDivider.vue +292 -54
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbItem.vue +657 -126
- package/dist/src/components/Btn/OrigamBtn.vue +928 -249
- package/dist/src/components/Btn/OrigamBtnGroup.vue +658 -141
- package/dist/src/components/Btn/OrigamBtnToggle.vue +578 -91
- package/dist/src/components/Calendar/OrigamCalendar.vue +1142 -484
- package/dist/src/components/Card/OrigamCard.vue +938 -194
- package/dist/src/components/Card/OrigamCardHeader.vue +593 -104
- package/dist/src/components/Card/OrigamCardText.vue +536 -84
- package/dist/src/components/Carousel/OrigamCarousel.vue +778 -202
- package/dist/src/components/Carousel/OrigamCarouselItem.vue +660 -109
- package/dist/src/components/Chart/OrigamChart.vue +942 -452
- package/dist/src/components/Chart/OrigamChartAxis.vue +111 -19
- package/dist/src/components/Chart/OrigamChartBoxPlot.vue +713 -297
- package/dist/src/components/Chart/OrigamChartBullet.vue +701 -286
- package/dist/src/components/Chart/OrigamChartCandlestick.vue +663 -243
- package/dist/src/components/Chart/OrigamChartCartesian.vue +1055 -487
- package/dist/src/components/Chart/OrigamChartGauge.vue +563 -164
- package/dist/src/components/Chart/OrigamChartHeatmap.vue +677 -251
- package/dist/src/components/Chart/OrigamChartHoneycomb.vue +700 -288
- package/dist/src/components/Chart/OrigamChartLegend.vue +108 -16
- package/dist/src/components/Chart/OrigamChartMap.vue +723 -299
- package/dist/src/components/Chart/OrigamChartPareto.vue +721 -276
- package/dist/src/components/Chart/OrigamChartPictorial.vue +777 -355
- package/dist/src/components/Chart/OrigamChartPolar.vue +603 -210
- package/dist/src/components/Chart/OrigamChartPolarBar.vue +674 -271
- package/dist/src/components/Chart/OrigamChartPyramid.vue +685 -250
- package/dist/src/components/Chart/OrigamChartRadar.vue +515 -165
- package/dist/src/components/Chart/OrigamChartRangeSelector.vue +50 -25
- package/dist/src/components/Chart/OrigamChartSankey.vue +913 -467
- package/dist/src/components/Chart/OrigamChartSparkline.vue +711 -268
- package/dist/src/components/Chart/OrigamChartStreamgraph.vue +810 -368
- package/dist/src/components/Chart/OrigamChartSunburst.vue +779 -368
- package/dist/src/components/Chart/OrigamChartTooltip.vue +78 -19
- package/dist/src/components/Chart/OrigamChartTreemap.vue +750 -288
- package/dist/src/components/Chart/OrigamChartVariwide.vue +679 -251
- package/dist/src/components/Chart/OrigamChartWordCloud.vue +674 -265
- package/dist/src/components/Checkbox/OrigamCheckbox.vue +781 -136
- package/dist/src/components/Checkbox/OrigamCheckboxBtn.vue +465 -81
- package/dist/src/components/Checkbox/OrigamCheckboxGroup.vue +824 -137
- package/dist/src/components/Chip/OrigamChip.vue +867 -202
- package/dist/src/components/Chip/OrigamChipGroup.vue +633 -121
- package/dist/src/components/ClientOnly/OrigamClientOnly.vue +30 -4
- package/dist/src/components/Clipboard/OrigamClipboard.vue +624 -105
- package/dist/src/components/Code/OrigamCode.vue +844 -206
- package/dist/src/components/CodeGroup/OrigamCodeGroup.vue +494 -83
- package/dist/src/components/ColorPicker/OrigamColorPicker.vue +777 -159
- package/dist/src/components/ColorPicker/OrigamColorPickerCanvas.vue +295 -181
- package/dist/src/components/ColorPicker/OrigamColorPickerEdit.vue +108 -45
- package/dist/src/components/ColorPicker/OrigamColorPickerPreview.vue +131 -46
- package/dist/src/components/ColorPicker/OrigamColorPickerSwatches.vue +128 -39
- package/dist/src/components/ColorPickerField/OrigamColorPickerField.vue +1123 -258
- package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +415 -162
- package/dist/src/components/ConfirmWrapper/OrigamConfirmWrapper.vue +389 -145
- package/dist/src/components/ContextualMenu/OrigamContextualMenu.vue +852 -147
- package/dist/src/components/Counter/OrigamCounter.vue +588 -96
- package/dist/src/components/DataList/OrigamDataList.vue +619 -113
- package/dist/src/components/DataList/OrigamDataText.vue +295 -65
- package/dist/src/components/DataList/OrigamDataTitle.vue +295 -65
- package/dist/src/components/DataTable/OrigamDataTable.vue +934 -222
- package/dist/src/components/DataTable/OrigamDataTableColumnCell.vue +196 -51
- package/dist/src/components/DataTable/OrigamDataTableFooter.vue +319 -78
- package/dist/src/components/DataTable/OrigamDataTableGroupHeaderRow.vue +124 -44
- package/dist/src/components/DataTable/OrigamDataTableHeaderCell.vue +181 -70
- package/dist/src/components/DataTable/OrigamDataTableHeaders.vue +155 -46
- package/dist/src/components/DataTable/OrigamDataTableHeadersCell.vue +145 -27
- package/dist/src/components/DataTable/OrigamDataTableHeadersCellMobile.vue +126 -43
- package/dist/src/components/DataTable/OrigamDataTableRow.vue +151 -73
- package/dist/src/components/DataTable/OrigamDataTableRows.vue +261 -106
- package/dist/src/components/DatePicker/OrigamDatePicker.vue +1048 -261
- package/dist/src/components/DatePicker/OrigamDatePickerControls.vue +155 -51
- package/dist/src/components/DatePicker/OrigamDatePickerHeader.vue +147 -46
- package/dist/src/components/DatePicker/OrigamDatePickerMonth.vue +312 -134
- package/dist/src/components/DatePicker/OrigamDatePickerMonths.vue +151 -61
- package/dist/src/components/DatePicker/OrigamDatePickerYears.vue +154 -67
- package/dist/src/components/DatePickerField/OrigamDatePickerField.vue +1147 -306
- package/dist/src/components/DefaultsProvider/OrigamDefaultsProvider.vue +74 -14
- package/dist/src/components/Dialog/OrigamDialog.vue +953 -196
- package/dist/src/components/Dialog/OrigamDialogConfirmation.vue +886 -148
- package/dist/src/components/Divider/OrigamDivider.vue +210 -50
- package/dist/src/components/Drawer/OrigamDrawer.vue +909 -207
- package/dist/src/components/EmptyState/OrigamEmptyState.vue +146 -35
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanel.vue +746 -159
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelContent.vue +591 -95
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelHeader.vue +663 -143
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanels.vue +675 -134
- package/dist/src/components/Field/OrigamField.vue +1118 -306
- package/dist/src/components/FileField/OrigamFileField.vue +1188 -311
- package/dist/src/components/FileField/OrigamFileFieldDragNDropItem.vue +155 -36
- package/dist/src/components/FileField/OrigamFileFieldListItem.vue +155 -36
- package/dist/src/components/Form/OrigamForm.vue +197 -74
- package/dist/src/components/Grid/OrigamGrid.vue +707 -147
- package/dist/src/components/Grid/OrigamGridItem.vue +110 -37
- package/dist/src/components/Grids/OrigamCol.vue +593 -110
- package/dist/src/components/Grids/OrigamContainer.vue +461 -80
- package/dist/src/components/Grids/OrigamRow.vue +573 -112
- package/dist/src/components/Grids/OrigamSpacer.vue +54 -17
- package/dist/src/components/Icon/OrigamClassIcon.vue +573 -98
- package/dist/src/components/Icon/OrigamComponentIcon.vue +561 -101
- package/dist/src/components/Icon/OrigamIcon.vue +561 -98
- package/dist/src/components/Icon/OrigamLigatureIcon.vue +558 -98
- package/dist/src/components/Icon/OrigamSvgIcon.vue +593 -100
- package/dist/src/components/Img/OrigamImg.vue +869 -228
- package/dist/src/components/InfiniteScroll/OrigamInfiniteScroll.vue +319 -111
- package/dist/src/components/InfiniteScroll/OrigamInfiniteScrollIntersect.vue +80 -17
- package/dist/src/components/InlineEdit/OrigamInlineEdit.vue +476 -140
- package/dist/src/components/Input/OrigamInput.vue +747 -180
- package/dist/src/components/ItemGroup/OrigamItemGroup.vue +112 -36
- package/dist/src/components/ItemGroup/OrigamItemGroupItem.vue +80 -29
- package/dist/src/components/Kbd/OrigamKbd.vue +450 -75
- package/dist/src/components/Label/OrigamLabel.vue +584 -95
- package/dist/src/components/Layout/OrigamLayout.vue +563 -94
- package/dist/src/components/Lazy/OrigamLazy.vue +131 -34
- package/dist/src/components/List/OrigamList.vue +755 -170
- package/dist/src/components/List/OrigamListChildren.vue +59 -19
- package/dist/src/components/List/OrigamListGroup.vue +631 -134
- package/dist/src/components/List/OrigamListGroupActivator.vue +45 -17
- package/dist/src/components/List/OrigamListItem.vue +890 -224
- package/dist/src/components/List/OrigamListItemWrapper.vue +20 -10
- package/dist/src/components/List/OrigamListSubheader.vue +542 -93
- package/dist/src/components/Loader/OrigamLoader.vue +110 -25
- package/dist/src/components/Main/OrigamMain.vue +565 -96
- package/dist/src/components/Masonry/OrigamMasonry.vue +799 -187
- package/dist/src/components/Media/OrigamMediaController.vue +465 -182
- package/dist/src/components/Media/OrigamMediaScrubber.vue +389 -152
- package/dist/src/components/Media/OrigamMediaVolumeControl.vue +174 -44
- package/dist/src/components/Menu/OrigamMenu.vue +1079 -255
- package/dist/src/components/Messages/OrigamMessages.vue +606 -97
- package/dist/src/components/NumberField/OrigamNumberField.vue +1208 -333
- package/dist/src/components/NumberFormat/OrigamNumberFormat.vue +177 -57
- package/dist/src/components/OtpInputField/OrigamOtpInputField.vue +1016 -272
- package/dist/src/components/Overlay/OrigamOverlay.vue +446 -158
- package/dist/src/components/Overlay/OrigamOverlayScrim.vue +122 -30
- package/dist/src/components/Pagination/OrigamPagination.vue +982 -313
- package/dist/src/components/Parallax/OrigamParallax.vue +800 -259
- package/dist/src/components/Parallax/OrigamParallaxElement.vue +694 -178
- package/dist/src/components/Parallax/OrigamParallaxLayer.vue +132 -47
- package/dist/src/components/PasswordField/OrigamPasswordField.vue +1098 -265
- package/dist/src/components/Picker/OrigamPicker.vue +655 -108
- package/dist/src/components/Picker/OrigamPickerTitle.vue +108 -26
- package/dist/src/components/Progress/OrigamProgress.vue +436 -70
- package/dist/src/components/Progress/OrigamProgressCircular.vue +399 -82
- package/dist/src/components/Progress/OrigamProgressLinear.vue +468 -115
- package/dist/src/components/QrCode/OrigamQrCode.vue +642 -126
- package/dist/src/components/Radio/OrigamRadio.vue +772 -132
- package/dist/src/components/Radio/OrigamRadioBtn.vue +446 -71
- package/dist/src/components/Radio/OrigamRadioGroup.vue +808 -135
- package/dist/src/components/RatingField/OrigamRatingField.vue +963 -194
- package/dist/src/components/RatingField/OrigamRatingFieldItem.vue +657 -106
- package/dist/src/components/Responsive/OrigamResponsive.vue +548 -91
- package/dist/src/components/Select/OrigamSelect.vue +1639 -567
- package/dist/src/components/SelectionControl/OrigamSelectionControl.vue +564 -151
- package/dist/src/components/SelectionControl/OrigamSelectionControlGroup.vue +178 -62
- package/dist/src/components/Sheet/OrigamSheet.vue +773 -199
- package/dist/src/components/Skeleton/OrigamSkeleton.vue +249 -46
- package/dist/src/components/Skeleton/OrigamSkeletonGroup.vue +66 -11
- package/dist/src/components/Slide/OrigamSlideGroup.vue +772 -257
- package/dist/src/components/SliderField/OrigamSliderField.vue +1157 -335
- package/dist/src/components/SliderField/OrigamSliderFieldTrack.vue +236 -112
- package/dist/src/components/Snackbar/OrigamSnackbar.vue +871 -214
- package/dist/src/components/Snackbar/OrigamSnackbarGroup.vue +218 -51
- package/dist/src/components/Snackbar/OrigamSnackbarItem.vue +175 -43
- package/dist/src/components/Stepper/OrigamStepper.vue +618 -126
- package/dist/src/components/Stepper/OrigamStepperItem.vue +98 -37
- package/dist/src/components/Switch/OrigamSwitch.vue +879 -156
- package/dist/src/components/Switch/OrigamSwitchTrack.vue +431 -78
- package/dist/src/components/SystemBar/OrigamSystemBar.vue +517 -87
- package/dist/src/components/Table/OrigamTable.vue +585 -124
- package/dist/src/components/Tabs/OrigamTab.vue +239 -73
- package/dist/src/components/Tabs/OrigamTabPanel.vue +125 -39
- package/dist/src/components/Tabs/OrigamTabPanels.vue +148 -57
- package/dist/src/components/Tabs/OrigamTabs.vue +381 -109
- package/dist/src/components/TextField/OrigamTextField.vue +1077 -258
- package/dist/src/components/TextMask/OrigamTextMask.vue +150 -43
- package/dist/src/components/TextareaField/OrigamTextareaField.vue +1162 -310
- package/dist/src/components/TextareaField/OrigamTextareaFieldRichToolbar.vue +77 -79
- package/dist/src/components/ThemeProvider/OrigamThemeProvider.vue +44 -9
- package/dist/src/components/Timeline/OrigamTimeline.vue +113 -43
- package/dist/src/components/Timeline/OrigamTimelineItem.vue +163 -76
- package/dist/src/components/Title/OrigamTitle.vue +505 -82
- package/dist/src/components/Toolbar/OrigamToolbar.vue +679 -142
- package/dist/src/components/Tooltip/OrigamTooltip.vue +288 -72
- package/dist/src/components/Transition/OrigamExpandX.vue +219 -106
- package/dist/src/components/Transition/OrigamExpandY.vue +219 -106
- package/dist/src/components/Transition/OrigamFade.vue +47 -9
- package/dist/src/components/Transition/OrigamReverseTranslatePicker.vue +52 -10
- package/dist/src/components/Transition/OrigamScaleRotate.vue +52 -10
- package/dist/src/components/Transition/OrigamSlideX.vue +52 -10
- package/dist/src/components/Transition/OrigamSlideY.vue +52 -10
- package/dist/src/components/Transition/OrigamSnack.vue +52 -10
- package/dist/src/components/Transition/OrigamTransition.vue +40 -12
- package/dist/src/components/Transition/OrigamTranslateBottom.vue +52 -10
- package/dist/src/components/Transition/OrigamTranslatePicker.vue +52 -10
- package/dist/src/components/Transition/OrigamTranslateScale.vue +209 -97
- package/dist/src/components/Transition/OrigamWindowXReverseTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowXTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowYReverseTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowYTranslate.vue +40 -7
- package/dist/src/components/Treeview/OrigamTreeview.vue +258 -118
- package/dist/src/components/Treeview/OrigamTreeviewNode.vue +126 -88
- package/dist/src/components/Video/OrigamVideo.vue +1178 -331
- package/dist/src/components/VirtualScroll/OrigamVirtualScroll.vue +147 -55
- package/dist/src/components/VirtualScroll/OrigamVirtualScrollItem.vue +94 -19
- package/dist/src/components/Watermark/OrigamWatermark.vue +224 -124
- package/dist/src/components/Window/OrigamWindow.vue +745 -175
- package/dist/src/components/Window/OrigamWindowItem.vue +162 -69
- package/dist/src/composables/Commons/display.composable.cjs +2 -0
- package/dist/src/composables/Commons/display.composable.js +1 -1
- package/dist/src/interfaces/Pagination/pagination.interface.d.ts +1 -1
- package/package.json +8 -8
|
@@ -220,12 +220,7 @@
|
|
|
220
220
|
</template>
|
|
221
221
|
|
|
222
222
|
<script lang="ts" setup>
|
|
223
|
-
import {
|
|
224
|
-
computed,
|
|
225
|
-
onBeforeUnmount,
|
|
226
|
-
ref,
|
|
227
|
-
watch
|
|
228
|
-
} from "vue";
|
|
223
|
+
import { computed, onBeforeUnmount, ref, watch } from "vue";
|
|
229
224
|
import { OrigamBtn } from "../Btn";
|
|
230
225
|
import { OrigamIcon } from "../Icon";
|
|
231
226
|
import { OrigamMediaController } from "../Media";
|
|
@@ -244,453 +239,1305 @@ import { useTypography } from "../../composables/Commons/typography.composable";
|
|
|
244
239
|
import { useVideoPlayer } from "../../composables/Video/video-player.composable";
|
|
245
240
|
import { MDI_ICONS } from "../../enums/Commons/mdi.enum";
|
|
246
241
|
import { VIDEO_TRACK_KIND } from "../../enums/Video/video.enum";
|
|
242
|
+
/*********************************************************
|
|
243
|
+
* Global
|
|
244
|
+
*
|
|
245
|
+
* @description
|
|
246
|
+
* Props + defaults for `<OrigamVideo>`. The component is a thin
|
|
247
|
+
* default skin on top of `useVideoPlayer` — it owns the toolbar
|
|
248
|
+
* markup, the poster / loading / error overlays, and the wiring
|
|
249
|
+
* between the native `<video>` element and the headless composable.
|
|
250
|
+
*
|
|
251
|
+
* Three controls modes:
|
|
252
|
+
* - 'custom' (default): toolbar painted by this component.
|
|
253
|
+
* - 'native': the native `controls` attribute is set on the
|
|
254
|
+
* `<video>` and no custom UI is rendered.
|
|
255
|
+
* - 'none': nothing — consumers either drive the player through
|
|
256
|
+
* the `#controls` slot or programmatically.
|
|
257
|
+
*
|
|
258
|
+
* Defaults are inlined here (not pulled from a `VIDEO_DEFAULTS`
|
|
259
|
+
* const) because the Vue SFC compiler analyses `withDefaults`
|
|
260
|
+
* statically and only resolves literals — cf. CLAUDE.md rule.
|
|
261
|
+
********************************************************/
|
|
262
|
+
/*********************************************************
|
|
263
|
+
* i18n — every user-facing label and aria string passes through
|
|
264
|
+
* `t()`. Media-shared keys live under `origam.media.*`, video-only
|
|
265
|
+
* ones (fullscreen, pip, captions) under `origam.video.*`.
|
|
266
|
+
********************************************************/
|
|
247
267
|
const { t } = useLocale();
|
|
248
268
|
const props = defineProps({
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
269
|
+
src: {
|
|
270
|
+
type: [String, Array],
|
|
271
|
+
required: true
|
|
272
|
+
},
|
|
273
|
+
poster: {
|
|
274
|
+
type: String,
|
|
275
|
+
required: false,
|
|
276
|
+
default: undefined
|
|
277
|
+
},
|
|
278
|
+
tracks: {
|
|
279
|
+
type: Array,
|
|
280
|
+
required: false,
|
|
281
|
+
default: () => []
|
|
282
|
+
},
|
|
283
|
+
autoplay: {
|
|
284
|
+
type: Boolean,
|
|
285
|
+
required: false,
|
|
286
|
+
default: false
|
|
287
|
+
},
|
|
288
|
+
muted: {
|
|
289
|
+
type: Boolean,
|
|
290
|
+
required: false,
|
|
291
|
+
default: false
|
|
292
|
+
},
|
|
293
|
+
loop: {
|
|
294
|
+
type: Boolean,
|
|
295
|
+
required: false,
|
|
296
|
+
default: false
|
|
297
|
+
},
|
|
298
|
+
controls: {
|
|
299
|
+
type: null,
|
|
300
|
+
required: false,
|
|
301
|
+
default: "custom"
|
|
302
|
+
},
|
|
303
|
+
playsInline: {
|
|
304
|
+
type: Boolean,
|
|
305
|
+
required: false,
|
|
306
|
+
default: true
|
|
307
|
+
},
|
|
308
|
+
preload: {
|
|
309
|
+
type: String,
|
|
310
|
+
required: false,
|
|
311
|
+
default: "metadata"
|
|
312
|
+
},
|
|
313
|
+
aspectRatio: {
|
|
314
|
+
type: String,
|
|
315
|
+
required: false,
|
|
316
|
+
default: "16/9"
|
|
317
|
+
},
|
|
318
|
+
crossorigin: {
|
|
319
|
+
type: null,
|
|
320
|
+
required: false,
|
|
321
|
+
default: undefined
|
|
322
|
+
},
|
|
323
|
+
disablePictureInPicture: {
|
|
324
|
+
type: Boolean,
|
|
325
|
+
required: false,
|
|
326
|
+
default: false
|
|
327
|
+
},
|
|
328
|
+
skipSeconds: {
|
|
329
|
+
type: Number,
|
|
330
|
+
required: false,
|
|
331
|
+
default: 30
|
|
332
|
+
},
|
|
333
|
+
showCenterControls: {
|
|
334
|
+
type: Boolean,
|
|
335
|
+
required: false,
|
|
336
|
+
default: true
|
|
337
|
+
},
|
|
338
|
+
playbackRates: {
|
|
339
|
+
type: Array,
|
|
340
|
+
required: false,
|
|
341
|
+
default: () => [
|
|
342
|
+
.25,
|
|
343
|
+
.5,
|
|
344
|
+
.75,
|
|
345
|
+
1,
|
|
346
|
+
1.25,
|
|
347
|
+
1.5,
|
|
348
|
+
1.75,
|
|
349
|
+
2
|
|
350
|
+
]
|
|
351
|
+
},
|
|
352
|
+
playbackRate: {
|
|
353
|
+
type: Number,
|
|
354
|
+
required: false,
|
|
355
|
+
default: 1
|
|
356
|
+
},
|
|
357
|
+
inset: {
|
|
358
|
+
type: Boolean,
|
|
359
|
+
required: false,
|
|
360
|
+
default: true
|
|
361
|
+
},
|
|
362
|
+
allowRemotePlayback: {
|
|
363
|
+
type: Boolean,
|
|
364
|
+
required: false,
|
|
365
|
+
default: true
|
|
366
|
+
},
|
|
367
|
+
doubleTapToSkip: {
|
|
368
|
+
type: Boolean,
|
|
369
|
+
required: false,
|
|
370
|
+
default: true
|
|
371
|
+
},
|
|
372
|
+
downloadable: {
|
|
373
|
+
type: Boolean,
|
|
374
|
+
required: false,
|
|
375
|
+
default: false
|
|
376
|
+
},
|
|
377
|
+
downloadFilename: {
|
|
378
|
+
type: String,
|
|
379
|
+
required: false,
|
|
380
|
+
default: undefined
|
|
381
|
+
},
|
|
382
|
+
id: {
|
|
383
|
+
type: String,
|
|
384
|
+
required: false
|
|
385
|
+
},
|
|
386
|
+
class: {
|
|
387
|
+
type: [
|
|
388
|
+
String,
|
|
389
|
+
Array,
|
|
390
|
+
Object
|
|
391
|
+
],
|
|
392
|
+
required: false
|
|
393
|
+
},
|
|
394
|
+
style: {
|
|
395
|
+
type: [
|
|
396
|
+
String,
|
|
397
|
+
Array,
|
|
398
|
+
Object,
|
|
399
|
+
Boolean,
|
|
400
|
+
null
|
|
401
|
+
],
|
|
402
|
+
required: false,
|
|
403
|
+
skipCheck: true
|
|
404
|
+
},
|
|
405
|
+
color: {
|
|
406
|
+
type: [
|
|
407
|
+
String,
|
|
408
|
+
Object,
|
|
409
|
+
Boolean,
|
|
410
|
+
null
|
|
411
|
+
],
|
|
412
|
+
required: false,
|
|
413
|
+
skipCheck: true,
|
|
414
|
+
default: undefined
|
|
415
|
+
},
|
|
416
|
+
bgColor: {
|
|
417
|
+
type: [
|
|
418
|
+
String,
|
|
419
|
+
Object,
|
|
420
|
+
Boolean,
|
|
421
|
+
null
|
|
422
|
+
],
|
|
423
|
+
required: false,
|
|
424
|
+
skipCheck: true,
|
|
425
|
+
default: undefined
|
|
426
|
+
},
|
|
427
|
+
height: {
|
|
428
|
+
type: [Number, String],
|
|
429
|
+
required: false
|
|
430
|
+
},
|
|
431
|
+
maxHeight: {
|
|
432
|
+
type: [Number, String],
|
|
433
|
+
required: false
|
|
434
|
+
},
|
|
435
|
+
maxWidth: {
|
|
436
|
+
type: [Number, String],
|
|
437
|
+
required: false
|
|
438
|
+
},
|
|
439
|
+
minHeight: {
|
|
440
|
+
type: [Number, String],
|
|
441
|
+
required: false
|
|
442
|
+
},
|
|
443
|
+
minWidth: {
|
|
444
|
+
type: [Number, String],
|
|
445
|
+
required: false
|
|
446
|
+
},
|
|
447
|
+
width: {
|
|
448
|
+
type: [Number, String],
|
|
449
|
+
required: false
|
|
450
|
+
},
|
|
451
|
+
rounded: {
|
|
452
|
+
type: [
|
|
453
|
+
Boolean,
|
|
454
|
+
Number,
|
|
455
|
+
String,
|
|
456
|
+
null
|
|
457
|
+
],
|
|
458
|
+
required: false,
|
|
459
|
+
skipCheck: true
|
|
460
|
+
},
|
|
461
|
+
roundedTopRight: {
|
|
462
|
+
type: [
|
|
463
|
+
Boolean,
|
|
464
|
+
Number,
|
|
465
|
+
String
|
|
466
|
+
],
|
|
467
|
+
required: false
|
|
468
|
+
},
|
|
469
|
+
roundedTopLeft: {
|
|
470
|
+
type: [
|
|
471
|
+
Boolean,
|
|
472
|
+
Number,
|
|
473
|
+
String
|
|
474
|
+
],
|
|
475
|
+
required: false
|
|
476
|
+
},
|
|
477
|
+
roundedBottomLeft: {
|
|
478
|
+
type: [
|
|
479
|
+
Boolean,
|
|
480
|
+
Number,
|
|
481
|
+
String
|
|
482
|
+
],
|
|
483
|
+
required: false
|
|
484
|
+
},
|
|
485
|
+
roundedBottomRight: {
|
|
486
|
+
type: [
|
|
487
|
+
Boolean,
|
|
488
|
+
Number,
|
|
489
|
+
String
|
|
490
|
+
],
|
|
491
|
+
required: false
|
|
492
|
+
},
|
|
493
|
+
roundedStartStart: {
|
|
494
|
+
type: [
|
|
495
|
+
Boolean,
|
|
496
|
+
Number,
|
|
497
|
+
String
|
|
498
|
+
],
|
|
499
|
+
required: false
|
|
500
|
+
},
|
|
501
|
+
roundedStartEnd: {
|
|
502
|
+
type: [
|
|
503
|
+
Boolean,
|
|
504
|
+
Number,
|
|
505
|
+
String
|
|
506
|
+
],
|
|
507
|
+
required: false
|
|
508
|
+
},
|
|
509
|
+
roundedEndStart: {
|
|
510
|
+
type: [
|
|
511
|
+
Boolean,
|
|
512
|
+
Number,
|
|
513
|
+
String
|
|
514
|
+
],
|
|
515
|
+
required: false
|
|
516
|
+
},
|
|
517
|
+
roundedEndEnd: {
|
|
518
|
+
type: [
|
|
519
|
+
Boolean,
|
|
520
|
+
Number,
|
|
521
|
+
String
|
|
522
|
+
],
|
|
523
|
+
required: false
|
|
524
|
+
},
|
|
525
|
+
border: {
|
|
526
|
+
type: [
|
|
527
|
+
Boolean,
|
|
528
|
+
Number,
|
|
529
|
+
String,
|
|
530
|
+
Array
|
|
531
|
+
],
|
|
532
|
+
required: false,
|
|
533
|
+
skipCheck: true
|
|
534
|
+
},
|
|
535
|
+
borderTop: {
|
|
536
|
+
type: [
|
|
537
|
+
Boolean,
|
|
538
|
+
Number,
|
|
539
|
+
String
|
|
540
|
+
],
|
|
541
|
+
required: false
|
|
542
|
+
},
|
|
543
|
+
borderLeft: {
|
|
544
|
+
type: [
|
|
545
|
+
Boolean,
|
|
546
|
+
Number,
|
|
547
|
+
String
|
|
548
|
+
],
|
|
549
|
+
required: false
|
|
550
|
+
},
|
|
551
|
+
borderBottom: {
|
|
552
|
+
type: [
|
|
553
|
+
Boolean,
|
|
554
|
+
Number,
|
|
555
|
+
String
|
|
556
|
+
],
|
|
557
|
+
required: false
|
|
558
|
+
},
|
|
559
|
+
borderRight: {
|
|
560
|
+
type: [
|
|
561
|
+
Boolean,
|
|
562
|
+
Number,
|
|
563
|
+
String
|
|
564
|
+
],
|
|
565
|
+
required: false
|
|
566
|
+
},
|
|
567
|
+
borderBlock: {
|
|
568
|
+
type: [
|
|
569
|
+
Boolean,
|
|
570
|
+
Number,
|
|
571
|
+
String
|
|
572
|
+
],
|
|
573
|
+
required: false
|
|
574
|
+
},
|
|
575
|
+
borderInline: {
|
|
576
|
+
type: [
|
|
577
|
+
Boolean,
|
|
578
|
+
Number,
|
|
579
|
+
String
|
|
580
|
+
],
|
|
581
|
+
required: false
|
|
582
|
+
},
|
|
583
|
+
borderInlineStart: {
|
|
584
|
+
type: [
|
|
585
|
+
Boolean,
|
|
586
|
+
Number,
|
|
587
|
+
String
|
|
588
|
+
],
|
|
589
|
+
required: false
|
|
590
|
+
},
|
|
591
|
+
borderInlineEnd: {
|
|
592
|
+
type: [
|
|
593
|
+
Boolean,
|
|
594
|
+
Number,
|
|
595
|
+
String
|
|
596
|
+
],
|
|
597
|
+
required: false
|
|
598
|
+
},
|
|
599
|
+
borderBlockStart: {
|
|
600
|
+
type: [
|
|
601
|
+
Boolean,
|
|
602
|
+
Number,
|
|
603
|
+
String
|
|
604
|
+
],
|
|
605
|
+
required: false
|
|
606
|
+
},
|
|
607
|
+
borderBlockEnd: {
|
|
608
|
+
type: [
|
|
609
|
+
Boolean,
|
|
610
|
+
Number,
|
|
611
|
+
String
|
|
612
|
+
],
|
|
613
|
+
required: false
|
|
614
|
+
},
|
|
615
|
+
borderColor: {
|
|
616
|
+
type: String,
|
|
617
|
+
required: false
|
|
618
|
+
},
|
|
619
|
+
borderStyle: {
|
|
620
|
+
type: String,
|
|
621
|
+
required: false
|
|
622
|
+
},
|
|
623
|
+
borderTopColor: {
|
|
624
|
+
type: [
|
|
625
|
+
String,
|
|
626
|
+
Object,
|
|
627
|
+
Boolean,
|
|
628
|
+
null
|
|
629
|
+
],
|
|
630
|
+
required: false,
|
|
631
|
+
skipCheck: true
|
|
632
|
+
},
|
|
633
|
+
borderRightColor: {
|
|
634
|
+
type: [
|
|
635
|
+
String,
|
|
636
|
+
Object,
|
|
637
|
+
Boolean,
|
|
638
|
+
null
|
|
639
|
+
],
|
|
640
|
+
required: false,
|
|
641
|
+
skipCheck: true
|
|
642
|
+
},
|
|
643
|
+
borderBottomColor: {
|
|
644
|
+
type: [
|
|
645
|
+
String,
|
|
646
|
+
Object,
|
|
647
|
+
Boolean,
|
|
648
|
+
null
|
|
649
|
+
],
|
|
650
|
+
required: false,
|
|
651
|
+
skipCheck: true
|
|
652
|
+
},
|
|
653
|
+
borderLeftColor: {
|
|
654
|
+
type: [
|
|
655
|
+
String,
|
|
656
|
+
Object,
|
|
657
|
+
Boolean,
|
|
658
|
+
null
|
|
659
|
+
],
|
|
660
|
+
required: false,
|
|
661
|
+
skipCheck: true
|
|
662
|
+
},
|
|
663
|
+
borderInlineStartColor: {
|
|
664
|
+
type: [
|
|
665
|
+
String,
|
|
666
|
+
Object,
|
|
667
|
+
Boolean,
|
|
668
|
+
null
|
|
669
|
+
],
|
|
670
|
+
required: false,
|
|
671
|
+
skipCheck: true
|
|
672
|
+
},
|
|
673
|
+
borderInlineEndColor: {
|
|
674
|
+
type: [
|
|
675
|
+
String,
|
|
676
|
+
Object,
|
|
677
|
+
Boolean,
|
|
678
|
+
null
|
|
679
|
+
],
|
|
680
|
+
required: false,
|
|
681
|
+
skipCheck: true
|
|
682
|
+
},
|
|
683
|
+
borderBlockStartColor: {
|
|
684
|
+
type: [
|
|
685
|
+
String,
|
|
686
|
+
Object,
|
|
687
|
+
Boolean,
|
|
688
|
+
null
|
|
689
|
+
],
|
|
690
|
+
required: false,
|
|
691
|
+
skipCheck: true
|
|
692
|
+
},
|
|
693
|
+
borderBlockEndColor: {
|
|
694
|
+
type: [
|
|
695
|
+
String,
|
|
696
|
+
Object,
|
|
697
|
+
Boolean,
|
|
698
|
+
null
|
|
699
|
+
],
|
|
700
|
+
required: false,
|
|
701
|
+
skipCheck: true
|
|
702
|
+
},
|
|
703
|
+
margin: {
|
|
704
|
+
type: [
|
|
705
|
+
Boolean,
|
|
706
|
+
Number,
|
|
707
|
+
String
|
|
708
|
+
],
|
|
709
|
+
required: false
|
|
710
|
+
},
|
|
711
|
+
marginTop: {
|
|
712
|
+
type: [
|
|
713
|
+
Boolean,
|
|
714
|
+
Number,
|
|
715
|
+
String
|
|
716
|
+
],
|
|
717
|
+
required: false
|
|
718
|
+
},
|
|
719
|
+
marginLeft: {
|
|
720
|
+
type: [
|
|
721
|
+
Boolean,
|
|
722
|
+
Number,
|
|
723
|
+
String
|
|
724
|
+
],
|
|
725
|
+
required: false
|
|
726
|
+
},
|
|
727
|
+
marginBottom: {
|
|
728
|
+
type: [
|
|
729
|
+
Boolean,
|
|
730
|
+
Number,
|
|
731
|
+
String
|
|
732
|
+
],
|
|
733
|
+
required: false
|
|
734
|
+
},
|
|
735
|
+
marginRight: {
|
|
736
|
+
type: [
|
|
737
|
+
Boolean,
|
|
738
|
+
Number,
|
|
739
|
+
String
|
|
740
|
+
],
|
|
741
|
+
required: false
|
|
742
|
+
},
|
|
743
|
+
marginBlock: {
|
|
744
|
+
type: [
|
|
745
|
+
Boolean,
|
|
746
|
+
Number,
|
|
747
|
+
String
|
|
748
|
+
],
|
|
749
|
+
required: false
|
|
750
|
+
},
|
|
751
|
+
marginInline: {
|
|
752
|
+
type: [
|
|
753
|
+
Boolean,
|
|
754
|
+
Number,
|
|
755
|
+
String
|
|
756
|
+
],
|
|
757
|
+
required: false
|
|
758
|
+
},
|
|
759
|
+
marginInlineStart: {
|
|
760
|
+
type: [
|
|
761
|
+
Boolean,
|
|
762
|
+
Number,
|
|
763
|
+
String
|
|
764
|
+
],
|
|
765
|
+
required: false
|
|
766
|
+
},
|
|
767
|
+
marginInlineEnd: {
|
|
768
|
+
type: [
|
|
769
|
+
Boolean,
|
|
770
|
+
Number,
|
|
771
|
+
String
|
|
772
|
+
],
|
|
773
|
+
required: false
|
|
774
|
+
},
|
|
775
|
+
marginBlockStart: {
|
|
776
|
+
type: [
|
|
777
|
+
Boolean,
|
|
778
|
+
Number,
|
|
779
|
+
String
|
|
780
|
+
],
|
|
781
|
+
required: false
|
|
782
|
+
},
|
|
783
|
+
marginBlockEnd: {
|
|
784
|
+
type: [
|
|
785
|
+
Boolean,
|
|
786
|
+
Number,
|
|
787
|
+
String
|
|
788
|
+
],
|
|
789
|
+
required: false
|
|
790
|
+
},
|
|
791
|
+
padding: {
|
|
792
|
+
type: [
|
|
793
|
+
Boolean,
|
|
794
|
+
Number,
|
|
795
|
+
String
|
|
796
|
+
],
|
|
797
|
+
required: false
|
|
798
|
+
},
|
|
799
|
+
paddingTop: {
|
|
800
|
+
type: [
|
|
801
|
+
Boolean,
|
|
802
|
+
Number,
|
|
803
|
+
String
|
|
804
|
+
],
|
|
805
|
+
required: false
|
|
806
|
+
},
|
|
807
|
+
paddingLeft: {
|
|
808
|
+
type: [
|
|
809
|
+
Boolean,
|
|
810
|
+
Number,
|
|
811
|
+
String
|
|
812
|
+
],
|
|
813
|
+
required: false
|
|
814
|
+
},
|
|
815
|
+
paddingBottom: {
|
|
816
|
+
type: [
|
|
817
|
+
Boolean,
|
|
818
|
+
Number,
|
|
819
|
+
String
|
|
820
|
+
],
|
|
821
|
+
required: false
|
|
822
|
+
},
|
|
823
|
+
paddingRight: {
|
|
824
|
+
type: [
|
|
825
|
+
Boolean,
|
|
826
|
+
Number,
|
|
827
|
+
String
|
|
828
|
+
],
|
|
829
|
+
required: false
|
|
830
|
+
},
|
|
831
|
+
paddingBlock: {
|
|
832
|
+
type: [
|
|
833
|
+
Boolean,
|
|
834
|
+
Number,
|
|
835
|
+
String
|
|
836
|
+
],
|
|
837
|
+
required: false
|
|
838
|
+
},
|
|
839
|
+
paddingInline: {
|
|
840
|
+
type: [
|
|
841
|
+
Boolean,
|
|
842
|
+
Number,
|
|
843
|
+
String
|
|
844
|
+
],
|
|
845
|
+
required: false
|
|
846
|
+
},
|
|
847
|
+
paddingInlineStart: {
|
|
848
|
+
type: [
|
|
849
|
+
Boolean,
|
|
850
|
+
Number,
|
|
851
|
+
String
|
|
852
|
+
],
|
|
853
|
+
required: false
|
|
854
|
+
},
|
|
855
|
+
paddingInlineEnd: {
|
|
856
|
+
type: [
|
|
857
|
+
Boolean,
|
|
858
|
+
Number,
|
|
859
|
+
String
|
|
860
|
+
],
|
|
861
|
+
required: false
|
|
862
|
+
},
|
|
863
|
+
paddingBlockStart: {
|
|
864
|
+
type: [
|
|
865
|
+
Boolean,
|
|
866
|
+
Number,
|
|
867
|
+
String
|
|
868
|
+
],
|
|
869
|
+
required: false
|
|
870
|
+
},
|
|
871
|
+
paddingBlockEnd: {
|
|
872
|
+
type: [
|
|
873
|
+
Boolean,
|
|
874
|
+
Number,
|
|
875
|
+
String
|
|
876
|
+
],
|
|
877
|
+
required: false
|
|
878
|
+
},
|
|
879
|
+
elevation: {
|
|
880
|
+
type: [Number, String],
|
|
881
|
+
required: false
|
|
882
|
+
},
|
|
883
|
+
fontSize: {
|
|
884
|
+
type: null,
|
|
885
|
+
required: false
|
|
886
|
+
}
|
|
335
887
|
});
|
|
336
|
-
const emit = defineEmits([
|
|
888
|
+
const emit = defineEmits([
|
|
889
|
+
"enterfullscreen",
|
|
890
|
+
"exitfullscreen",
|
|
891
|
+
"enterpip",
|
|
892
|
+
"exitpip",
|
|
893
|
+
"skip",
|
|
894
|
+
"quality-change",
|
|
895
|
+
"download",
|
|
896
|
+
"play",
|
|
897
|
+
"pause",
|
|
898
|
+
"ended",
|
|
899
|
+
"timeupdate",
|
|
900
|
+
"volumechange",
|
|
901
|
+
"loadedmetadata",
|
|
902
|
+
"error",
|
|
903
|
+
"update:playbackRate"
|
|
904
|
+
]);
|
|
337
905
|
defineSlots();
|
|
906
|
+
/*********************************************************
|
|
907
|
+
* Icon refs — single source of truth for the toolbar glyphs.
|
|
908
|
+
********************************************************/
|
|
338
909
|
const ICONS = {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
910
|
+
PLAY: MDI_ICONS.PLAY,
|
|
911
|
+
PAUSE: MDI_ICONS.PAUSE,
|
|
912
|
+
LOADING: MDI_ICONS.LOADING,
|
|
913
|
+
ALERT: MDI_ICONS.ALERT_CIRCLE,
|
|
914
|
+
CAPTIONS: MDI_ICONS.CLOSED_CAPTION,
|
|
915
|
+
PIP: MDI_ICONS.PICTURE_IN_PICTURE_BOTTOM_RIGHT,
|
|
916
|
+
FULLSCREEN: MDI_ICONS.FULLSCREEN,
|
|
917
|
+
FULLSCREEN_EXIT: MDI_ICONS.FULLSCREEN_EXIT,
|
|
918
|
+
CHEVRON_LEFT: MDI_ICONS.CHEVRON_LEFT,
|
|
919
|
+
CHEVRON_RIGHT: MDI_ICONS.CHEVRON_RIGHT
|
|
349
920
|
};
|
|
921
|
+
/*********************************************************
|
|
922
|
+
* Resolved autoplay / muted — autoplay is suppressed when the user
|
|
923
|
+
* prefers reduced motion (a11y), and the browser requires muted=true
|
|
924
|
+
* for unattended playback in most cases. The composable also logs
|
|
925
|
+
* the suppression at mount time; we keep the SFC-level resolution
|
|
926
|
+
* here so the native `<video autoplay>` attribute is correct from
|
|
927
|
+
* the very first render.
|
|
928
|
+
********************************************************/
|
|
350
929
|
const resolvedAutoplay = computed(() => {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
930
|
+
if (!props.autoplay) return false;
|
|
931
|
+
if (shouldSuppressAutoplay()) return false;
|
|
932
|
+
return true;
|
|
354
933
|
});
|
|
355
934
|
const resolvedMuted = computed(() => {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
935
|
+
if (props.muted) return true;
|
|
936
|
+
// Browsers gate `autoplay` on `muted` — auto-force when the
|
|
937
|
+
// consumer asked for autoplay without explicitly muting.
|
|
938
|
+
if (resolvedAutoplay.value) return true;
|
|
939
|
+
return false;
|
|
359
940
|
});
|
|
941
|
+
/*********************************************************
|
|
942
|
+
* Source resolution — `src` can be a single URL or an array of
|
|
943
|
+
* `<source>` descriptors. When it's an array we render multiple
|
|
944
|
+
* `<source>` children; when it's a string we set the `src`
|
|
945
|
+
* attribute on the `<video>` directly (and skip the children).
|
|
946
|
+
********************************************************/
|
|
360
947
|
const singleSrc = computed(() => {
|
|
361
|
-
|
|
948
|
+
return typeof props.src === "string" ? props.src : undefined;
|
|
362
949
|
});
|
|
363
950
|
const resolvedSources = computed(() => {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
951
|
+
const sources = Array.isArray(props.src) ? props.src : [];
|
|
952
|
+
// When quality variants are declared, only render the active
|
|
953
|
+
// quality's <source> tags (plus any without a quality field,
|
|
954
|
+
// which are treated as codec siblings of every quality). The
|
|
955
|
+
// quality switcher then `video.load()`-swaps the underlying URL
|
|
956
|
+
// directly via `video.src`, so this list only matters for the
|
|
957
|
+
// initial mount.
|
|
958
|
+
if (currentQuality.value && hasQualityOptions.value) {
|
|
959
|
+
return sources.filter((s) => !s.quality || s.quality === currentQuality.value);
|
|
960
|
+
}
|
|
961
|
+
return sources;
|
|
369
962
|
});
|
|
963
|
+
/*********************************************************
|
|
964
|
+
* Composable — ADR-005, do not eagerly read `resolvedMuted.value`
|
|
965
|
+
*
|
|
966
|
+
* @description
|
|
967
|
+
* `useVideoPlayer({...})` runs synchronously in the body of
|
|
968
|
+
* `setup()`. Passing `resolvedMuted.value` here used to EVALUATE
|
|
969
|
+
* that `computed` for the first time right there — before the
|
|
970
|
+
* theme-props-resolver's `beforeCreate` patches `instance.props`.
|
|
971
|
+
* A Vue `computed` MEMOIZES its result until a tracked dependency
|
|
972
|
+
* is invalidated; this eager access "poisoned" the cache with the
|
|
973
|
+
* PRE-theme value, and — since the ADR-005 patch does not reliably
|
|
974
|
+
* trigger that invalidation (root CLAUDE.md) — the SAME stale
|
|
975
|
+
* value then leaked into the template's OWN `:muted="resolvedMuted"`
|
|
976
|
+
* binding on the native `<video>`, not just this composable's
|
|
977
|
+
* internal seed. Verified at runtime: with a theme setting
|
|
978
|
+
* `muted: true`, `resolvedMuted` stayed `false` and the native
|
|
979
|
+
* element's `.muted` property was `false` (#673).
|
|
980
|
+
*
|
|
981
|
+
* @description
|
|
982
|
+
* ⛔ issue #661 (fixed on the sibling `OrigamAudio`, still open here
|
|
983
|
+
* before this commit) — #673's own fix stopped at passing the RAW
|
|
984
|
+
* `props.autoplay` / `props.muted` values, which avoided the
|
|
985
|
+
* computed-poisoning regression above but is ITSELF still an eager
|
|
986
|
+
* read (flagged by `setup-reads.mjs`: `Video [autoplay, muted]`) —
|
|
987
|
+
* `useVideoPlayer`'s own internal `state.muted` seed and the
|
|
988
|
+
* dev-time reduced-motion warning (`MEDIA_AUTOPLAY_SUPPRESSED_WARNING`)
|
|
989
|
+
* could still see the pre-theme value. `IUseMediaPlayerOptions.autoplay`
|
|
990
|
+
* / `.muted` accept a `MaybeRefOrGetter` PRECISELY for this: a getter
|
|
991
|
+
* has NO cache to poison (unlike a `computed`) — `toValue()` re-invokes
|
|
992
|
+
* it fresh every time, inside `bind()` (`onMounted`, i.e. after
|
|
993
|
+
* `beforeCreate`) — so it closes the ADR-005 gap without reproducing
|
|
994
|
+
* #673's regression. Mirrors `OrigamAudio.vue`'s identical fix exactly
|
|
995
|
+
* (`autoplay: () => props.autoplay, muted: () => resolvedMuted.value`).
|
|
996
|
+
* `loop` / `preload` are dropped: neither is read anywhere in
|
|
997
|
+
* `useMediaPlayer` / `useVideoPlayer` (dead pass-through) — the
|
|
998
|
+
* native `loop` / `preload` attributes are already driven directly
|
|
999
|
+
* by the auto-exposed `loop` / `preload` props in the template.
|
|
1000
|
+
********************************************************/
|
|
370
1001
|
const { videoRef, state, methods } = useVideoPlayer({
|
|
371
|
-
|
|
372
|
-
|
|
1002
|
+
autoplay: () => props.autoplay,
|
|
1003
|
+
muted: () => resolvedMuted.value
|
|
373
1004
|
});
|
|
1005
|
+
/*********************************************************
|
|
1006
|
+
* Native event handlers — forward to the parent emit pipeline. The
|
|
1007
|
+
* composable already listens to the same events internally; the
|
|
1008
|
+
* forwarding here keeps the public emit contract independent of
|
|
1009
|
+
* the headless state surface.
|
|
1010
|
+
********************************************************/
|
|
374
1011
|
function onTimeUpdate() {
|
|
375
|
-
|
|
1012
|
+
emit("timeupdate", state.currentTime.value);
|
|
376
1013
|
}
|
|
377
1014
|
function onVolumeChange() {
|
|
378
|
-
|
|
1015
|
+
emit("volumechange", state.volume.value);
|
|
379
1016
|
}
|
|
380
1017
|
const naturalWidth = ref(null);
|
|
381
1018
|
const naturalHeight = ref(null);
|
|
382
1019
|
function onLoadedMetadata(event) {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
1020
|
+
const v = event.target;
|
|
1021
|
+
if (v.videoWidth && v.videoHeight) {
|
|
1022
|
+
naturalWidth.value = v.videoWidth;
|
|
1023
|
+
naturalHeight.value = v.videoHeight;
|
|
1024
|
+
}
|
|
1025
|
+
emit("loadedmetadata", { duration: state.duration.value });
|
|
389
1026
|
}
|
|
1027
|
+
// Effective aspect-ratio fed to OrigamResponsive. Priority:
|
|
1028
|
+
// 1. Explicit `aspectRatio` prop (string '16/9' or number).
|
|
1029
|
+
// 2. Natural dimensions from <video> metadata once loaded.
|
|
1030
|
+
// 3. Fallback to 16/9 so the placeholder area has a sensible
|
|
1031
|
+
// shape before the video metadata arrives.
|
|
390
1032
|
const effectiveAspectRatio = computed(() => {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
1033
|
+
if (props.aspectRatio) return props.aspectRatio;
|
|
1034
|
+
if (naturalWidth.value && naturalHeight.value) {
|
|
1035
|
+
return naturalWidth.value / naturalHeight.value;
|
|
1036
|
+
}
|
|
1037
|
+
return "16/9";
|
|
396
1038
|
});
|
|
397
1039
|
function onErrorEvent() {
|
|
398
|
-
|
|
1040
|
+
if (state.error.value) emit("error", state.error.value);
|
|
399
1041
|
}
|
|
1042
|
+
/*********************************************************
|
|
1043
|
+
* Hover / auto-hide state — `inset` controls auto-fade once the
|
|
1044
|
+
* cursor leaves the player (except while paused, where the
|
|
1045
|
+
* toolbar stays visible). `hovered` also gates the center-control
|
|
1046
|
+
* overlay (play / ±skip buttons floating over the video).
|
|
1047
|
+
********************************************************/
|
|
400
1048
|
const hovered = ref(false);
|
|
401
1049
|
const onPlayerMouseEnter = () => {
|
|
402
|
-
|
|
1050
|
+
hovered.value = true;
|
|
403
1051
|
};
|
|
404
1052
|
const onPlayerMouseLeave = () => {
|
|
405
|
-
|
|
1053
|
+
hovered.value = false;
|
|
406
1054
|
};
|
|
407
1055
|
const controlsVisible = computed(() => {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
1056
|
+
// In `inset` mode the bottom toolbar auto-hides while the
|
|
1057
|
+
// video plays and the cursor sits outside the player. In the
|
|
1058
|
+
// non-inset (always-on) mode, the toolbar always paints.
|
|
1059
|
+
if (!props.inset) return true;
|
|
1060
|
+
if (state.paused.value) return true;
|
|
1061
|
+
return hovered.value;
|
|
411
1062
|
});
|
|
1063
|
+
/*********************************************************
|
|
1064
|
+
* Skip handlers — wrap the composable skip methods so we also
|
|
1065
|
+
* emit a `skip` event (positive seconds = forward, negative =
|
|
1066
|
+
* backward). The default skip seconds come from the prop.
|
|
1067
|
+
********************************************************/
|
|
412
1068
|
const skipBy = (seconds) => {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
1069
|
+
if (seconds > 0) methods.skipForward(seconds);
|
|
1070
|
+
else if (seconds < 0) methods.skipBackward(Math.abs(seconds));
|
|
1071
|
+
emit("skip", seconds);
|
|
416
1072
|
};
|
|
417
1073
|
const onSkipBack = () => skipBy(-Math.abs(props.skipSeconds || 0));
|
|
418
1074
|
const onSkipForward = () => skipBy(Math.abs(props.skipSeconds || 0));
|
|
1075
|
+
/*********************************************************
|
|
1076
|
+
* Double-tap / double-click to skip. YouTube-style: two clicks
|
|
1077
|
+
* within 300ms on the same half (left = backward, right =
|
|
1078
|
+
* forward) of the video surface trigger a skip. Works for BOTH
|
|
1079
|
+
* touch (pointerType === 'touch') AND mouse (pointerType ===
|
|
1080
|
+
* 'mouse' or 'pen') so desktop users get the same behaviour
|
|
1081
|
+
* as mobile.
|
|
1082
|
+
*
|
|
1083
|
+
* Single clicks fall through to the center play/pause button
|
|
1084
|
+
* via the parent overlay — no `event.stopPropagation()` here.
|
|
1085
|
+
*
|
|
1086
|
+
* The visual feedback (ripple + seconds badge) is driven by
|
|
1087
|
+
* `skipFeedback`, consumed by the template overlay.
|
|
1088
|
+
********************************************************/
|
|
419
1089
|
const _lastTap = ref(null);
|
|
420
1090
|
const skipFeedback = ref(null);
|
|
421
1091
|
let _skipFeedbackTimeout = -1;
|
|
1092
|
+
/*********************************************************
|
|
1093
|
+
* Center state pulse — purely cosmetic flash at the centre of the
|
|
1094
|
+
* video when play/pause toggles (YouTube pattern). pointer-events:
|
|
1095
|
+
* none, never absorbs clicks. Disappears after 600 ms.
|
|
1096
|
+
********************************************************/
|
|
422
1097
|
const statePulse = ref(null);
|
|
423
1098
|
let _statePulseTimeout = -1;
|
|
424
1099
|
function triggerStatePulse(kind) {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
1100
|
+
statePulse.value = {
|
|
1101
|
+
kind,
|
|
1102
|
+
id: Date.now()
|
|
1103
|
+
};
|
|
1104
|
+
if (_statePulseTimeout !== -1) window.clearTimeout(_statePulseTimeout);
|
|
1105
|
+
_statePulseTimeout = window.setTimeout(() => {
|
|
1106
|
+
statePulse.value = null;
|
|
1107
|
+
_statePulseTimeout = -1;
|
|
1108
|
+
}, 600);
|
|
431
1109
|
}
|
|
432
1110
|
const triggerSkipFeedback = (side) => {
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
1111
|
+
skipFeedback.value = {
|
|
1112
|
+
side,
|
|
1113
|
+
seconds: props.skipSeconds,
|
|
1114
|
+
id: Date.now()
|
|
1115
|
+
};
|
|
1116
|
+
if (_skipFeedbackTimeout !== -1) window.clearTimeout(_skipFeedbackTimeout);
|
|
1117
|
+
_skipFeedbackTimeout = window.setTimeout(() => {
|
|
1118
|
+
skipFeedback.value = null;
|
|
1119
|
+
_skipFeedbackTimeout = -1;
|
|
1120
|
+
}, 700);
|
|
439
1121
|
};
|
|
1122
|
+
/*********************************************************
|
|
1123
|
+
* Single-tap deferred toggle. YouTube-style: a click on the
|
|
1124
|
+
* video surface toggles play / pause, but if a second tap lands
|
|
1125
|
+
* within 300 ms on the SAME side, that gesture turns into a
|
|
1126
|
+
* skip and the deferred toggle is cancelled. Net effect:
|
|
1127
|
+
* - single click → toggle (after a ~280 ms delay)
|
|
1128
|
+
* - double click → skip on same side (no toggle)
|
|
1129
|
+
* OR toggle on different side (cancels pending)
|
|
1130
|
+
********************************************************/
|
|
440
1131
|
let _pendingTogglePlayTimeout = -1;
|
|
441
1132
|
function schedulePendingTogglePlay() {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
1133
|
+
clearPendingTogglePlay();
|
|
1134
|
+
_pendingTogglePlayTimeout = window.setTimeout(() => {
|
|
1135
|
+
togglePlay();
|
|
1136
|
+
_pendingTogglePlayTimeout = -1;
|
|
1137
|
+
}, 280);
|
|
447
1138
|
}
|
|
448
1139
|
function clearPendingTogglePlay() {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
1140
|
+
if (_pendingTogglePlayTimeout !== -1) {
|
|
1141
|
+
window.clearTimeout(_pendingTogglePlayTimeout);
|
|
1142
|
+
_pendingTogglePlayTimeout = -1;
|
|
1143
|
+
}
|
|
453
1144
|
}
|
|
454
1145
|
onBeforeUnmount(() => {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
1146
|
+
if (_skipFeedbackTimeout !== -1) window.clearTimeout(_skipFeedbackTimeout);
|
|
1147
|
+
if (_statePulseTimeout !== -1) window.clearTimeout(_statePulseTimeout);
|
|
1148
|
+
clearPendingTogglePlay();
|
|
458
1149
|
});
|
|
459
1150
|
const onVideoTap = (event) => {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
1151
|
+
// Skip keyboard / synthetic events without coordinates.
|
|
1152
|
+
if (event.clientX == null) return;
|
|
1153
|
+
// Ignore taps on the inline center skip buttons — they have
|
|
1154
|
+
// their own @click handlers and should not also count as a
|
|
1155
|
+
// surface tap.
|
|
1156
|
+
const eventTarget = event.target;
|
|
1157
|
+
if (eventTarget?.closest(".origam-video__center-btn")) return;
|
|
1158
|
+
// Compute the side based on the VIDEO element bounding box,
|
|
1159
|
+
// not the current target (which may be the center overlay).
|
|
1160
|
+
const videoEl = videoRef.value;
|
|
1161
|
+
if (!videoEl) return;
|
|
1162
|
+
const rect = videoEl.getBoundingClientRect();
|
|
1163
|
+
const side = event.clientX - rect.left < rect.width / 2 ? "left" : "right";
|
|
1164
|
+
const now = Date.now();
|
|
1165
|
+
const last = _lastTap.value;
|
|
1166
|
+
if (props.doubleTapToSkip && last && now - last.time < 300 && last.side === side) {
|
|
1167
|
+
// Second tap of a same-side pair → skip, suppress the pending
|
|
1168
|
+
// togglePlay that was queued by the first tap.
|
|
1169
|
+
clearPendingTogglePlay();
|
|
1170
|
+
if (side === "left") onSkipBack();
|
|
1171
|
+
else onSkipForward();
|
|
1172
|
+
triggerSkipFeedback(side);
|
|
1173
|
+
_lastTap.value = null;
|
|
1174
|
+
event.preventDefault();
|
|
1175
|
+
} else {
|
|
1176
|
+
// First tap (or a second tap that doesn't qualify as a
|
|
1177
|
+
// same-side skip pair): record for a potential pairing and
|
|
1178
|
+
// schedule a deferred togglePlay. If a second tap comes in
|
|
1179
|
+
// soon enough on the same side, the pending toggle is
|
|
1180
|
+
// cancelled and a skip happens instead.
|
|
1181
|
+
_lastTap.value = {
|
|
1182
|
+
time: now,
|
|
1183
|
+
side
|
|
1184
|
+
};
|
|
1185
|
+
schedulePendingTogglePlay();
|
|
1186
|
+
}
|
|
480
1187
|
};
|
|
1188
|
+
/*********************************************************
|
|
1189
|
+
* Quality switcher — derived from the unique `quality` values
|
|
1190
|
+
* exposed by the source array. Only renders when ≥ 2 distinct
|
|
1191
|
+
* qualities exist. The component otherwise plays whatever the
|
|
1192
|
+
* browser picked first (typical mp4 + webm dual-source case).
|
|
1193
|
+
*
|
|
1194
|
+
* The Controller shell handles the menu UI; OrigamVideo keeps the
|
|
1195
|
+
* derivation + the `<source>` swap because both depend on the
|
|
1196
|
+
* `props.src` shape which is video-specific.
|
|
1197
|
+
********************************************************/
|
|
1198
|
+
// `src` is required here (unlike the generic `TQualityOption.src?`):
|
|
1199
|
+
// every entry is derived from `IVideoSource.src`, which IS required —
|
|
1200
|
+
// the `video.src = target.src` swap below relies on that guarantee.
|
|
481
1201
|
const qualityOptions = computed(() => {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
1202
|
+
const sources = Array.isArray(props.src) ? props.src : [];
|
|
1203
|
+
const seen = new Set();
|
|
1204
|
+
const out = [];
|
|
1205
|
+
for (const s of sources) {
|
|
1206
|
+
if (!s?.quality || seen.has(s.quality)) continue;
|
|
1207
|
+
seen.add(s.quality);
|
|
1208
|
+
out.push({
|
|
1209
|
+
quality: s.quality,
|
|
1210
|
+
label: s.label ?? s.quality,
|
|
1211
|
+
src: s.src,
|
|
1212
|
+
type: s.type
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
return out;
|
|
491
1216
|
});
|
|
492
1217
|
const hasQualityOptions = computed(() => qualityOptions.value.length >= 2);
|
|
493
1218
|
const currentQuality = ref(null);
|
|
1219
|
+
// Initialise the active quality from the first source that has one
|
|
1220
|
+
// once the props settle.
|
|
494
1221
|
const initQuality = () => {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
1222
|
+
if (currentQuality.value !== null) return;
|
|
1223
|
+
if (!hasQualityOptions.value) return;
|
|
1224
|
+
currentQuality.value = qualityOptions.value[0].quality;
|
|
498
1225
|
};
|
|
499
1226
|
initQuality();
|
|
500
1227
|
function onQualityClick(quality) {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
1228
|
+
const target = qualityOptions.value.find((q) => q.quality === quality);
|
|
1229
|
+
if (!target || !videoRef.value) return;
|
|
1230
|
+
const video = videoRef.value;
|
|
1231
|
+
const wasPaused = video.paused;
|
|
1232
|
+
const at = video.currentTime;
|
|
1233
|
+
currentQuality.value = quality;
|
|
1234
|
+
emit("quality-change", quality);
|
|
1235
|
+
// Swap source in place, then resume position + play state once
|
|
1236
|
+
// the new track has its metadata ready.
|
|
1237
|
+
const onReady = () => {
|
|
1238
|
+
try {
|
|
1239
|
+
video.currentTime = at;
|
|
1240
|
+
} catch {}
|
|
1241
|
+
if (!wasPaused) video.play().catch(() => {/* autoplay blocked, ignore */});
|
|
1242
|
+
video.removeEventListener("loadedmetadata", onReady);
|
|
1243
|
+
};
|
|
1244
|
+
video.addEventListener("loadedmetadata", onReady);
|
|
1245
|
+
video.src = target.src;
|
|
1246
|
+
video.load();
|
|
520
1247
|
}
|
|
1248
|
+
/*********************************************************
|
|
1249
|
+
* Download — the cog-menu row is a NATIVE `<a href :download>` in
|
|
1250
|
+
* `<OrigamMediaController>`, so the browser fires the download
|
|
1251
|
+
* action directly from the user click (no JS-side `a.click()`
|
|
1252
|
+
* orchestration, no `fetch` round-trip). We just relay the emit
|
|
1253
|
+
* upward for analytics / parent forwarding.
|
|
1254
|
+
*
|
|
1255
|
+
* Cross-origin caveat : per HTML spec, browsers IGNORE the
|
|
1256
|
+
* `download` attribute on cross-origin links. Self-hosted videos
|
|
1257
|
+
* therefore trigger a real "Save as…" flow ; a video on a
|
|
1258
|
+
* third-party CDN navigates instead unless the CDN sends
|
|
1259
|
+
* `Content-Disposition: attachment`. Documented in the doc
|
|
1260
|
+
* page — there is no JS-side workaround that survives a user
|
|
1261
|
+
* gesture trace without a CORS-friendly CDN.
|
|
1262
|
+
********************************************************/
|
|
521
1263
|
function onDownloadClick() {
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
1264
|
+
const url = downloadUrl.value;
|
|
1265
|
+
if (!url) return;
|
|
1266
|
+
emit("download", url);
|
|
525
1267
|
}
|
|
526
1268
|
const downloadUrl = computed(() => {
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
1269
|
+
if (typeof props.src === "string") return props.src || null;
|
|
1270
|
+
// Multi-source array: prefer the active quality, fall back to first.
|
|
1271
|
+
const sources = props.src;
|
|
1272
|
+
if (!sources.length) return null;
|
|
1273
|
+
if (currentQuality.value) {
|
|
1274
|
+
const match = sources.find((s) => s.quality === currentQuality.value);
|
|
1275
|
+
if (match) return match.src;
|
|
1276
|
+
}
|
|
1277
|
+
return sources[0]?.src ?? null;
|
|
535
1278
|
});
|
|
1279
|
+
/*********************************************************
|
|
1280
|
+
* Apply initial playback rate (prop) once metadata is ready.
|
|
1281
|
+
* Subsequent prop changes are honoured via the watcher below.
|
|
1282
|
+
********************************************************/
|
|
536
1283
|
watch(() => props.playbackRate, (rate) => {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
1284
|
+
if (typeof rate === "number" && Number.isFinite(rate) && rate > 0) {
|
|
1285
|
+
methods.setPlaybackRate(rate);
|
|
1286
|
+
}
|
|
540
1287
|
}, { immediate: true });
|
|
1288
|
+
/*********************************************************
|
|
1289
|
+
* Forward playback-rate changes initiated by the Controller's
|
|
1290
|
+
* config menu via the public `update:playbackRate` emit so the
|
|
1291
|
+
* v-model contract on the wrapper stays intact.
|
|
1292
|
+
********************************************************/
|
|
541
1293
|
watch(() => state.playbackRate.value, (rate) => {
|
|
542
|
-
|
|
1294
|
+
emit("update:playbackRate", rate);
|
|
543
1295
|
});
|
|
1296
|
+
/*********************************************************
|
|
1297
|
+
* Toolbar handlers — wrap the composable methods so we can also
|
|
1298
|
+
* surface the user gesture as the matching emit event (parents
|
|
1299
|
+
* who want to log a play/pause click track these directly).
|
|
1300
|
+
********************************************************/
|
|
544
1301
|
function togglePlay() {
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
1302
|
+
if (state.playing.value) {
|
|
1303
|
+
methods.pause();
|
|
1304
|
+
triggerStatePulse("pause");
|
|
1305
|
+
} else {
|
|
1306
|
+
methods.play();
|
|
1307
|
+
triggerStatePulse("play");
|
|
1308
|
+
}
|
|
552
1309
|
}
|
|
553
1310
|
async function toggleFullscreenBtn() {
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
1311
|
+
const wasFs = state.fullscreen.value;
|
|
1312
|
+
await methods.toggleFullscreen();
|
|
1313
|
+
// The composable updates `fullscreen` via the document-level
|
|
1314
|
+
// `fullscreenchange` listener — after the await we know the
|
|
1315
|
+
// new value is committed and can fire the right event.
|
|
1316
|
+
if (state.fullscreen.value && !wasFs) emit("enterfullscreen");
|
|
1317
|
+
else if (!state.fullscreen.value && wasFs) emit("exitfullscreen");
|
|
558
1318
|
}
|
|
559
1319
|
async function togglePipBtn() {
|
|
560
|
-
|
|
1320
|
+
await methods.togglePip();
|
|
561
1321
|
}
|
|
1322
|
+
/*********************************************************
|
|
1323
|
+
* Captions — track the active text track index and allow toggling
|
|
1324
|
+
* the whole subtitle UI off. We treat any non-disabled track as
|
|
1325
|
+
* "captions on"; toggling off sets every track to `disabled`.
|
|
1326
|
+
********************************************************/
|
|
562
1327
|
const captionsEnabled = ref(false);
|
|
563
1328
|
const hasCaptions = computed(() => props.tracks.some((track) => {
|
|
564
|
-
|
|
1329
|
+
return track.kind === VIDEO_TRACK_KIND.CAPTIONS || track.kind === VIDEO_TRACK_KIND.SUBTITLES;
|
|
565
1330
|
}));
|
|
566
1331
|
function toggleCaptions() {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
1332
|
+
const el = videoRef.value;
|
|
1333
|
+
if (!el) return;
|
|
1334
|
+
const trackList = el.textTracks;
|
|
1335
|
+
captionsEnabled.value = !captionsEnabled.value;
|
|
1336
|
+
for (let i = 0; i < trackList.length; i++) {
|
|
1337
|
+
const track = trackList[i];
|
|
1338
|
+
if (!captionsEnabled.value) {
|
|
1339
|
+
track.mode = "disabled";
|
|
1340
|
+
} else {
|
|
1341
|
+
// Activate the first one that matches the user's
|
|
1342
|
+
// declared default; otherwise the very first.
|
|
1343
|
+
const declared = props.tracks[i];
|
|
1344
|
+
if (declared?.default) track.mode = "showing";
|
|
1345
|
+
else if (i === 0) track.mode = "showing";
|
|
1346
|
+
else track.mode = "disabled";
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
582
1349
|
}
|
|
1350
|
+
// Watch ready to initialise captions once tracks are wired up.
|
|
583
1351
|
watch(() => state.ready.value, (ready) => {
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
1352
|
+
if (!ready) return;
|
|
1353
|
+
const el = videoRef.value;
|
|
1354
|
+
if (!el) return;
|
|
1355
|
+
// Mirror the `default` attribute to our internal flag so the
|
|
1356
|
+
// first paint after metadata matches what the user expected.
|
|
1357
|
+
const someShowing = Array.from(el.textTracks).some((track) => track.mode === "showing");
|
|
1358
|
+
captionsEnabled.value = someShowing;
|
|
589
1359
|
});
|
|
1360
|
+
/*********************************************************
|
|
1361
|
+
* PIP support — fall back gracefully on browsers that don't expose
|
|
1362
|
+
* the API (Firefox, some embedded WebViews). We feature-detect at
|
|
1363
|
+
* computation time rather than at module load so SSR doesn't crash.
|
|
1364
|
+
********************************************************/
|
|
590
1365
|
const pipSupported = computed(() => {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
1366
|
+
if (props.disablePictureInPicture) return false;
|
|
1367
|
+
if (typeof document === "undefined") return false;
|
|
1368
|
+
const doc = document;
|
|
1369
|
+
return Boolean(doc.pictureInPictureEnabled);
|
|
595
1370
|
});
|
|
1371
|
+
/*********************************************************
|
|
1372
|
+
* Poster + error overlay visibility. The Controller owns time /
|
|
1373
|
+
* volume / scrubber formatting; OrigamVideo only computes what
|
|
1374
|
+
* the overlays need.
|
|
1375
|
+
********************************************************/
|
|
596
1376
|
const showPosterOverlay = computed(() => {
|
|
597
|
-
|
|
1377
|
+
return Boolean(props.poster) && state.paused.value && state.currentTime.value === 0 && !state.error.value;
|
|
598
1378
|
});
|
|
1379
|
+
/*********************************************************
|
|
1380
|
+
* Le message generique passe par `t()` : il resout
|
|
1381
|
+
* `origam.media.playback_error`, partage avec les autres surfaces
|
|
1382
|
+
* media (cf. OrigamAudio, #567). Un `MediaError` ne porte qu'un
|
|
1383
|
+
* `code` numerique, donc c'est cette branche qu'atteint une vraie
|
|
1384
|
+
* panne de decodage ; une `Error` JS levee par le composable garde
|
|
1385
|
+
* son propre `message`.
|
|
1386
|
+
********************************************************/
|
|
599
1387
|
const genericErrorMessage = computed(() => t("origam.media.playback_error"));
|
|
600
1388
|
const errorMessage = computed(() => {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
1389
|
+
const err = state.error.value;
|
|
1390
|
+
if (!err) return genericErrorMessage.value;
|
|
1391
|
+
if ("message" in err && err.message) return err.message;
|
|
1392
|
+
return genericErrorMessage.value;
|
|
605
1393
|
});
|
|
1394
|
+
/*********************************************************
|
|
1395
|
+
* Aria-label keys for the buttons injected into the
|
|
1396
|
+
* `#extraControlsRight` slot of the Controller. Computed so the
|
|
1397
|
+
* template stays free of inline ternaries (cf. CLAUDE.md "no
|
|
1398
|
+
* logic in templates").
|
|
1399
|
+
********************************************************/
|
|
606
1400
|
const captionsLabelKey = computed(() => {
|
|
607
|
-
|
|
1401
|
+
return captionsEnabled.value ? "origam.video.disable_captions" : "origam.video.enable_captions";
|
|
608
1402
|
});
|
|
609
1403
|
const pipLabelKey = computed(() => {
|
|
610
|
-
|
|
1404
|
+
return state.pip.value ? "origam.video.exit_pip" : "origam.video.enter_pip";
|
|
611
1405
|
});
|
|
612
1406
|
const fullscreenLabelKey = computed(() => {
|
|
613
|
-
|
|
1407
|
+
return state.fullscreen.value ? "origam.video.exit_fullscreen" : "origam.video.enter_fullscreen";
|
|
614
1408
|
});
|
|
615
1409
|
const fullscreenIcon = computed(() => {
|
|
616
|
-
|
|
1410
|
+
return state.fullscreen.value ? ICONS.FULLSCREEN_EXIT : ICONS.FULLSCREEN;
|
|
617
1411
|
});
|
|
1412
|
+
/*********************************************************
|
|
1413
|
+
* Slot bindings — single source of truth for the `#controls` slot.
|
|
1414
|
+
********************************************************/
|
|
618
1415
|
const slotBindings = computed(() => ({
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
1416
|
+
playing: state.playing.value,
|
|
1417
|
+
paused: state.paused.value,
|
|
1418
|
+
currentTime: state.currentTime.value,
|
|
1419
|
+
duration: state.duration.value,
|
|
1420
|
+
buffered: state.buffered.value,
|
|
1421
|
+
volume: state.volume.value,
|
|
1422
|
+
muted: state.muted.value,
|
|
1423
|
+
fullscreen: state.fullscreen.value,
|
|
1424
|
+
pip: state.pip.value,
|
|
1425
|
+
loading: state.loading.value,
|
|
1426
|
+
error: state.error.value,
|
|
1427
|
+
playbackRate: state.playbackRate.value,
|
|
1428
|
+
remoteAvailable: state.remoteAvailable.value,
|
|
1429
|
+
remoteState: state.remoteState.value,
|
|
1430
|
+
methods
|
|
634
1431
|
}));
|
|
1432
|
+
/*********************************************************
|
|
1433
|
+
* Colour mixin — `color` and `bgColor` props let the consumer
|
|
1434
|
+
* tint the video chrome (icons + scrubber) and the host
|
|
1435
|
+
* background. `useColorEffect` pairs them WCAG-aware so a
|
|
1436
|
+
* single intent (`color="primary"`) flows through without
|
|
1437
|
+
* leaving illegible text on a saturated surface.
|
|
1438
|
+
********************************************************/
|
|
635
1439
|
const { colorClasses, colorStyles } = useColorEffect(props);
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
1440
|
+
/*********************************************************
|
|
1441
|
+
* Props declarees sans effet (#550, critere C1)
|
|
1442
|
+
*
|
|
1443
|
+
* @description
|
|
1444
|
+
* ⛔ Exposees dans la story, parfois documentees, et pourtant lues
|
|
1445
|
+
* nulle part. Elles ne sont ni retirees — ca casserait la story et le
|
|
1446
|
+
* type d'un consommateur pour une prop qui ne faisait deja rien — ni
|
|
1447
|
+
* cablees a un comportement invente. Elles avertissent une fois, en
|
|
1448
|
+
* dev, avec la raison exacte. Meme traitement que la famille Chart.
|
|
1449
|
+
********************************************************/
|
|
1450
|
+
useUnsupportedProp("OrigamVideo", "showCenterControls", "no centre overlay is rendered; the controls live in the bottom bar only.", () => props.showCenterControls === true);
|
|
642
1451
|
const hasColorProp = computed(() => !!props.color);
|
|
643
1452
|
const hasBgColorProp = computed(() => !!props.bgColor);
|
|
1453
|
+
/*********************************************************
|
|
1454
|
+
* Layout composables — margin / padding / border / rounded /
|
|
1455
|
+
* elevation / dimension wired from the extended interface.
|
|
1456
|
+
********************************************************/
|
|
644
1457
|
const { borderClasses, borderStyles } = useBorder(props);
|
|
645
1458
|
const { marginClasses, marginStyles } = useMargin(props);
|
|
646
1459
|
const { paddingClasses, paddingStyles } = usePadding(props);
|
|
647
1460
|
const { roundedClasses, roundedStyles } = useRounded(props);
|
|
648
1461
|
const { elevationClasses } = useElevation(props);
|
|
649
1462
|
const { dimensionStyles } = useDimension(props);
|
|
1463
|
+
/*********************************************************
|
|
1464
|
+
* Typography — per-surface tokens.
|
|
1465
|
+
* video__loading → font-size (état overlay)
|
|
1466
|
+
* video--error → font-size (état overlay)
|
|
1467
|
+
* useColorEffect drives color; typographyStyles only sets font vars.
|
|
1468
|
+
********************************************************/
|
|
650
1469
|
const { typographyStyles: typographyLoadingStyles } = useTypography(props, "video__loading");
|
|
651
1470
|
const { typographyStyles: typographyErrorStyles } = useTypography(props, "video--error");
|
|
1471
|
+
/*********************************************************
|
|
1472
|
+
* scrubberColorStyle — drives `--origam-media-controller__scrubber---color`
|
|
1473
|
+
* on the host. The MediaController reads this variable for the
|
|
1474
|
+
* played-portion of the scrubber.
|
|
1475
|
+
*
|
|
1476
|
+
* - No `color` / `bgColor` prop → default to **white**.
|
|
1477
|
+
* The video overlay is dark (rgba(0,0,0,0.55) gradient on
|
|
1478
|
+
* the bottom bar) and the rest of the chrome (play/volume/
|
|
1479
|
+
* cog icons, time) is white via `.origam-video__btn`. A
|
|
1480
|
+
* white scrubber matches that hierarchy.
|
|
1481
|
+
*
|
|
1482
|
+
* - `color` OR `bgColor` set → `currentColor`. Through
|
|
1483
|
+
* `useColorEffect`'s class/style binding the host's `color`
|
|
1484
|
+
* is the resolved intent fg, so the scrubber adopts it.
|
|
1485
|
+
* (`bgColor="primary"` alone auto-pairs the fg to primary's
|
|
1486
|
+
* paired foreground token via `useColorEffect`, so the
|
|
1487
|
+
* scrubber tracks that contrast pair automatically.)
|
|
1488
|
+
********************************************************/
|
|
652
1489
|
const scrubberColorStyle = computed(() => {
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
1490
|
+
if (hasColorProp.value || hasBgColorProp.value) {
|
|
1491
|
+
return { "--origam-media-controller__scrubber---color": "currentColor" };
|
|
1492
|
+
}
|
|
1493
|
+
return { "--origam-media-controller__scrubber---color": "#ffffff" };
|
|
657
1494
|
});
|
|
1495
|
+
/*********************************************************
|
|
1496
|
+
* Class & Style
|
|
1497
|
+
********************************************************/
|
|
658
1498
|
const rootClasses = computed(() => [
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
1499
|
+
{
|
|
1500
|
+
"origam-video--playing": state.playing.value,
|
|
1501
|
+
"origam-video--paused": state.paused.value,
|
|
1502
|
+
"origam-video--loading": state.loading.value,
|
|
1503
|
+
"origam-video--error": state.error.value !== null,
|
|
1504
|
+
"origam-video--fullscreen": state.fullscreen.value,
|
|
1505
|
+
"origam-video--pip": state.pip.value,
|
|
1506
|
+
"origam-video--controls-native": props.controls === "native",
|
|
1507
|
+
"origam-video--controls-custom": props.controls === "custom",
|
|
1508
|
+
"origam-video--controls-none": props.controls === "none",
|
|
1509
|
+
"origam-video--has-color": hasColorProp.value,
|
|
1510
|
+
"origam-video--has-bg-color": hasBgColorProp.value
|
|
1511
|
+
},
|
|
1512
|
+
...colorClasses.value,
|
|
1513
|
+
borderClasses.value,
|
|
1514
|
+
roundedClasses.value,
|
|
1515
|
+
elevationClasses.value,
|
|
1516
|
+
marginClasses.value,
|
|
1517
|
+
paddingClasses.value,
|
|
1518
|
+
props.class
|
|
679
1519
|
]);
|
|
1520
|
+
// aspect-ratio is now handled by `<origam-responsive :aspect-ratio>`.
|
|
1521
|
+
// rootStyles carries the user pass-through + the scrubber colour
|
|
1522
|
+
// variable + the inline output of `useColorEffect` for raw / custom
|
|
1523
|
+
// values that don't have a utility class.
|
|
680
1524
|
const rootStyles = computed(() => [
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
1525
|
+
colorStyles.value,
|
|
1526
|
+
scrubberColorStyle.value,
|
|
1527
|
+
borderStyles.value,
|
|
1528
|
+
roundedStyles.value,
|
|
1529
|
+
marginStyles.value,
|
|
1530
|
+
paddingStyles.value,
|
|
1531
|
+
dimensionStyles.value,
|
|
1532
|
+
props.style
|
|
689
1533
|
]);
|
|
1534
|
+
/*********************************************************
|
|
1535
|
+
* Expose
|
|
1536
|
+
********************************************************/
|
|
690
1537
|
defineExpose({
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
1538
|
+
videoRef,
|
|
1539
|
+
state,
|
|
1540
|
+
methods
|
|
694
1541
|
});
|
|
695
1542
|
</script>
|
|
696
1543
|
|