Skip to content

Commit 32fbf35

Browse files
feat: SNI-6834 simplify video props interface
1 parent 1d6a2ea commit 32fbf35

File tree

1 file changed

+8
-30
lines changed

1 file changed

+8
-30
lines changed

packages/vue/src/components/AdvancedVideo.vue

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

5-
<script lang="ts">
5+
<script setup lang="ts">
66
/**
77
* @memberOf CloudinaryVueSDK
88
* @type {Component}
@@ -19,44 +19,19 @@ import {
1919
VideoSources,
2020
cancelCurrentlyRunningPlugins,
2121
} from "@cloudinary/html";
22-
import { SDKAnalyticsConstants } from "../internal/SDKAnalyticsConstants";
2322
2423
interface VideoProps {
2524
cldVid: CloudinaryVideo;
2625
plugins?: Plugins;
2726
sources?: VideoSources;
2827
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;
28+
[x: string]: any;
3729
}
38-
</script>
3930
40-
<script setup lang="ts">
4131
// Disabled linting due to [@vue/compiler-sfc] `defineProps` is a compiler macro and no longer needs to be imported.
4232
// eslint-disable-next-line no-undef
4333
const props = defineProps<VideoProps>();
4434
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-
6035
const videoRef = ref(null);
6136
let htmlLayerInstance;
6237
@@ -69,8 +44,7 @@ onMounted(() => {
6944
videoRef.value,
7045
props.cldVid,
7146
props.sources,
72-
props.plugins,
73-
getVideoAttributes(props)
47+
props.plugins
7448
);
7549
});
7650
@@ -81,7 +55,11 @@ onMounted(() => {
8155
onUpdated(() => {
8256
cancelCurrentlyRunningPlugins(htmlLayerInstance.htmlPluginState);
8357
// call html layer to update the dom again with plugins and reset toBeCanceled
84-
htmlLayerInstance.update(props.cldVid, props.plugins, SDKAnalyticsConstants);
58+
htmlLayerInstance.update(
59+
props.cldVid,
60+
props.sources,
61+
props.plugins
62+
);
8563
});
8664
8765
/**

0 commit comments

Comments
 (0)