Skip to content

Commit 23f960d

Browse files
committed
docs-#239: add info about raw transformation
1 parent ae1639a commit 23f960d

2 files changed

Lines changed: 46 additions & 37 deletions

File tree

docs/content/2.components/CldVideoPlayer.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,21 @@ be loaded from as well as any customization of that track.
134134
</template>
135135
```
136136

137+
## Raw Transformations
138+
139+
It is a common thing to add custom video transformations like fading effect in and out which can be done like following:
140+
141+
```html
142+
<template>
143+
<CldVideoPlayer
144+
width="600"
145+
height="600"
146+
src="<Cloudinary URL>"
147+
:transformation="{ raw_transformation: 'e_fade:2000,e_fade:-2000' }"
148+
/>
149+
</template>
150+
```
151+
137152
Learn more on the [Video Player Reference](https://cloudinary.com/documentation/video_player_api_reference#text_tracks) or
138153
the [Subtitles and Captions guide](https://cloudinary.com/documentation/video_player_customization#subtitles_and_captions).
139154

playground/app.vue

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,53 @@
22
import type {
33
CloudinaryUploadWidgetError,
44
CloudinaryUploadWidgetResults,
5-
} from '@cloudinary-util/types'
6-
import type { MediaType } from '../src/runtime/components/CldProductGallery.vue'
5+
} from "@cloudinary-util/types";
6+
import type { MediaType } from "../src/runtime/components/CldProductGallery.vue";
77
8-
const { url } = useCldImageUrl({ options: { src: '/cld-sample-5.jpg' } })
9-
console.log(url)
8+
const { url } = useCldImageUrl({ options: { src: "/cld-sample-5.jpg" } });
9+
console.log(url);
1010
1111
const { url: videoUrl } = useCldVideoUrl({
12-
options: { src: 'videos/mountain-stars' },
13-
})
14-
console.log(videoUrl)
12+
options: { src: "videos/mountain-stars" },
13+
});
14+
console.log(videoUrl);
1515
16-
const mediaAssets: { tag: string, mediaType?: MediaType }[] = [
17-
{ tag: 'electric_car_product_gallery_demo' }, // by default mediaType: "image"
18-
{ tag: 'electric_car_product_gallery_demo', mediaType: 'video' },
19-
{ tag: 'electric_car_360_product_gallery_demo', mediaType: 'spin' },
20-
]
16+
const mediaAssets: { tag: string; mediaType?: MediaType }[] = [
17+
{ tag: "electric_car_product_gallery_demo" }, // by default mediaType: "image"
18+
{ tag: "electric_car_product_gallery_demo", mediaType: "video" },
19+
{ tag: "electric_car_360_product_gallery_demo", mediaType: "spin" },
20+
];
2121
22-
const buttonId = 'open-btn'
22+
const buttonId = "open-btn";
2323
24-
const cldVideoRef = ref()
24+
const cldVideoRef = ref();
2525
2626
const chapters = {
27-
0: 'Chapter 1',
28-
6: 'Chapter 2',
29-
9: 'Chapter 3',
30-
}
27+
0: "Chapter 1",
28+
6: "Chapter 2",
29+
9: "Chapter 3",
30+
};
3131
3232
const colors = {
33-
accent: '#ff0000',
34-
base: '#00ff00',
35-
text: '#0000ff',
36-
}
33+
accent: "#ff0000",
34+
base: "#00ff00",
35+
text: "#0000ff",
36+
};
3737
3838
const onResult = (results: CloudinaryUploadWidgetResults) => {
39-
console.log('results', results)
40-
}
39+
console.log("results", results);
40+
};
4141
const onError = (
4242
error: CloudinaryUploadWidgetError,
43-
results: CloudinaryUploadWidgetResults,
43+
results: CloudinaryUploadWidgetResults
4444
) => {
45-
console.log('error', error)
46-
console.log('results', results)
47-
}
45+
console.log("error", error);
46+
console.log("results", results);
47+
};
4848
</script>
4949

5050
<template>
51-
<button :id="buttonId">
52-
Select Image or Video
53-
</button>
51+
<button :id="buttonId">Select Image or Video</button>
5452
<CldMediaLibrary
5553
api-key="12345"
5654
:button-id="buttonId"
@@ -83,6 +81,7 @@ const onError = (
8381
chapters-button
8482
:chapters="chapters"
8583
:colors="colors"
84+
:transformation="{ raw_transformation: 'e_fade:2000,e_fade:-2000' }"
8685
/>
8786
<CldUploadWidget
8887
v-slot="{ open }"
@@ -91,12 +90,7 @@ const onError = (
9190
:on-error="onError"
9291
:on-result="onResult"
9392
>
94-
<button
95-
type="button"
96-
@click="open"
97-
>
98-
Upload an Image
99-
</button>
93+
<button type="button" @click="open">Upload an Image</button>
10094
</CldUploadWidget>
10195
<CldUploadButton
10296
upload-preset="nuxt-cloudinary-unsigned"

0 commit comments

Comments
 (0)