Skip to content

Commit 9d2201f

Browse files
Merge pull request #233 from cloudinary/use-fetch-format-vue
feat: add useFetchFormat prop in vue sdk
2 parents 748a6ca + 59b9da7 commit 9d2201f

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

packages/vue/src/components/AdvancedVideo.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ interface VideoProps {
3131
plugins?: Plugins;
3232
sources?: VideoSources;
3333
cldPoster?: VideoPoster;
34+
useFetchFormat?: boolean;
3435
3536
[x: string]: any;
3637
}
@@ -53,7 +54,8 @@ onMounted(() => {
5354
props.sources,
5455
props.plugins,
5556
undefined,
56-
props.cldPoster
57+
props.cldPoster,
58+
{ useFetchFormat: props.useFetchFormat }
5759
);
5860
});
5961

packages/vue/tests/unit/AdvancedVideo.spec.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { mount } from "@vue/test-utils";
22
import { CloudinaryImage, CloudinaryVideo } from "@cloudinary/url-gen";
3-
import { auto, vp9 } from "@cloudinary/url-gen/qualifiers/videoCodec";
3+
import { auto, vp9, theora } from "@cloudinary/url-gen/qualifiers/videoCodec";
44
import { videoCodec } from "@cloudinary/url-gen/actions/transcode";
55
import { AdvancedVideo } from "../../src";
66
import { waitTicks } from "../unit/utils";
@@ -85,6 +85,38 @@ describe("AdvancedVideo", () => {
8585
);
8686
});
8787

88+
it("should render video with input sources when using useFetchFormat", async function () {
89+
const sources = [
90+
{
91+
type: "mp4",
92+
codecs: ["vp8", "vorbis"],
93+
transcode: videoCodec(auto()),
94+
},
95+
{
96+
type: "webm",
97+
codecs: ["avc1.4D401E", "mp4a.40.2"],
98+
transcode: videoCodec(vp9()),
99+
},
100+
{
101+
type: "ogv",
102+
codecs: ["theora"],
103+
transcode: videoCodec(theora()),
104+
},
105+
];
106+
107+
const component = mount(AdvancedVideo, {
108+
props: { cldVid: cloudinaryVideo, sources, useFetchFormat: true },
109+
});
110+
await waitTicks(1);
111+
112+
expect(component.html()).toContain(
113+
"<video>\n" +
114+
' <source src="https://res.cloudinary.com/demo/video/upload/vc_auto/f_mp4/sample" type="video/mp4; codecs=vp8, vorbis">\n' +
115+
' <source src="https://res.cloudinary.com/demo/video/upload/vc_vp9/f_webm/sample" type="video/webm; codecs=avc1.4D401E, mp4a.40.2">\n' +
116+
' <source src="https://res.cloudinary.com/demo/video/upload/vc_theora/f_ogv/sample" type="video/ogg; codecs=theora">\n</video>'
117+
);
118+
});
119+
88120
it("should pass video attributes", async function () {
89121
const component = mount(AdvancedVideo, {
90122
props: {

0 commit comments

Comments
 (0)