Skip to content

Commit 1d6a2ea

Browse files
feat: SNI-6834 add supported video attributes
1 parent 4fa3346 commit 1d6a2ea

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

packages/vue/src/components/AdvancedVideo.vue

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,7 @@
22
<video ref="videoRef" />
33
</template>
44

5-
<script setup lang="ts">
6-
// import { defineComponent } from "vue";
7-
8-
// export default defineComponent({
9-
// name: "AdvancedVideo",
10-
// props: {
11-
// url: String,
12-
// },
13-
// });
14-
5+
<script lang="ts">
156
/**
167
* @memberOf CloudinaryVueSDK
178
* @type {Component}
@@ -35,13 +26,37 @@ interface VideoProps {
3526
plugins?: Plugins;
3627
sources?: VideoSources;
3728
38-
[x: string]: any;
29+
// supported video attributes
30+
controls?: boolean;
31+
loop?: boolean;
32+
muted?: boolean;
33+
poster?: string;
34+
preload?: string;
35+
autoPlay?: boolean;
36+
playsInline?: boolean;
3937
}
38+
</script>
4039

40+
<script setup lang="ts">
4141
// Disabled linting due to [@vue/compiler-sfc] `defineProps` is a compiler macro and no longer needs to be imported.
4242
// eslint-disable-next-line no-undef
4343
const props = defineProps<VideoProps>();
4444
45+
/**
46+
* Returns video attributes.
47+
*/
48+
function getVideoAttributes(props: VideoProps) {
49+
return {
50+
controls: props.controls,
51+
loop: props.loop,
52+
muted: props.muted,
53+
poster: props.poster,
54+
preload: props.preload,
55+
autoplay: props.autoPlay,
56+
playsinline: props.playsInline,
57+
};
58+
}
59+
4560
const videoRef = ref(null);
4661
let htmlLayerInstance;
4762
@@ -54,8 +69,8 @@ onMounted(() => {
5469
videoRef.value,
5570
props.cldVid,
5671
props.sources,
57-
props.plugins
58-
// SDKAnalyticsConstants
72+
props.plugins,
73+
getVideoAttributes(props)
5974
);
6075
});
6176

0 commit comments

Comments
 (0)