Skip to content

Commit

Permalink
docs-#239: add info about raw transformation
Browse files Browse the repository at this point in the history
  • Loading branch information
Baroshem committed Nov 5, 2024
1 parent ae1639a commit 23f960d
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 37 deletions.
15 changes: 15 additions & 0 deletions docs/content/2.components/CldVideoPlayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,21 @@ be loaded from as well as any customization of that track.
</template>
```

## Raw Transformations

It is a common thing to add custom video transformations like fading effect in and out which can be done like following:

```html
<template>
<CldVideoPlayer
width="600"
height="600"
src="<Cloudinary URL>"
:transformation="{ raw_transformation: 'e_fade:2000,e_fade:-2000' }"
/>
</template>
```

Learn more on the [Video Player Reference](https://cloudinary.com/documentation/video_player_api_reference#text_tracks) or
the [Subtitles and Captions guide](https://cloudinary.com/documentation/video_player_customization#subtitles_and_captions).

Expand Down
68 changes: 31 additions & 37 deletions playground/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,53 @@
import type {
CloudinaryUploadWidgetError,
CloudinaryUploadWidgetResults,
} from '@cloudinary-util/types'
import type { MediaType } from '../src/runtime/components/CldProductGallery.vue'
} from "@cloudinary-util/types";

Check failure on line 5 in playground/app.vue

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 18)

Strings must use singlequote

Check failure on line 5 in playground/app.vue

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 18)

Extra semicolon
import type { MediaType } from "../src/runtime/components/CldProductGallery.vue";

Check failure on line 6 in playground/app.vue

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 18)

Strings must use singlequote

Check failure on line 6 in playground/app.vue

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 18)

Extra semicolon
const { url } = useCldImageUrl({ options: { src: '/cld-sample-5.jpg' } })
console.log(url)
const { url } = useCldImageUrl({ options: { src: "/cld-sample-5.jpg" } });

Check failure on line 8 in playground/app.vue

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 18)

Strings must use singlequote

Check failure on line 8 in playground/app.vue

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 18)

Extra semicolon
console.log(url);

Check failure on line 9 in playground/app.vue

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 18)

Extra semicolon
const { url: videoUrl } = useCldVideoUrl({
options: { src: 'videos/mountain-stars' },
})
console.log(videoUrl)
options: { src: "videos/mountain-stars" },

Check failure on line 12 in playground/app.vue

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 18)

Strings must use singlequote
});

Check failure on line 13 in playground/app.vue

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 18)

Extra semicolon
console.log(videoUrl);

Check failure on line 14 in playground/app.vue

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 18)

Extra semicolon
const mediaAssets: { tag: string, mediaType?: MediaType }[] = [
{ tag: 'electric_car_product_gallery_demo' }, // by default mediaType: "image"
{ tag: 'electric_car_product_gallery_demo', mediaType: 'video' },
{ tag: 'electric_car_360_product_gallery_demo', mediaType: 'spin' },
]
const mediaAssets: { tag: string; mediaType?: MediaType }[] = [
{ tag: "electric_car_product_gallery_demo" }, // by default mediaType: "image"
{ tag: "electric_car_product_gallery_demo", mediaType: "video" },
{ tag: "electric_car_360_product_gallery_demo", mediaType: "spin" },
];
const buttonId = 'open-btn'
const buttonId = "open-btn";
const cldVideoRef = ref()
const cldVideoRef = ref();
const chapters = {
0: 'Chapter 1',
6: 'Chapter 2',
9: 'Chapter 3',
}
0: "Chapter 1",
6: "Chapter 2",
9: "Chapter 3",
};
const colors = {
accent: '#ff0000',
base: '#00ff00',
text: '#0000ff',
}
accent: "#ff0000",
base: "#00ff00",
text: "#0000ff",
};
const onResult = (results: CloudinaryUploadWidgetResults) => {
console.log('results', results)
}
console.log("results", results);
};
const onError = (
error: CloudinaryUploadWidgetError,
results: CloudinaryUploadWidgetResults,
results: CloudinaryUploadWidgetResults
) => {
console.log('error', error)
console.log('results', results)
}
console.log("error", error);
console.log("results", results);
};
</script>

<template>
<button :id="buttonId">
Select Image or Video
</button>
<button :id="buttonId">Select Image or Video</button>

Check warning on line 51 in playground/app.vue

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 18)

Expected 1 line break after opening tag (`<button>`), but no line breaks found

Check warning on line 51 in playground/app.vue

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 18)

Expected 1 line break before closing tag (`</button>`), but no line breaks found
<CldMediaLibrary
api-key="12345"
:button-id="buttonId"
Expand Down Expand Up @@ -83,6 +81,7 @@ const onError = (
chapters-button
:chapters="chapters"
:colors="colors"
:transformation="{ raw_transformation: 'e_fade:2000,e_fade:-2000' }"
/>
<CldUploadWidget
v-slot="{ open }"
Expand All @@ -91,12 +90,7 @@ const onError = (
:on-error="onError"
:on-result="onResult"
>
<button
type="button"
@click="open"
>
Upload an Image
</button>
<button type="button" @click="open">Upload an Image</button>

Check warning on line 93 in playground/app.vue

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 18)

'@click' should be on a new line

Check warning on line 93 in playground/app.vue

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 18)

Expected 1 line break after opening tag (`<button>`), but no line breaks found

Check warning on line 93 in playground/app.vue

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 18)

Expected 1 line break before closing tag (`</button>`), but no line breaks found
</CldUploadWidget>
<CldUploadButton
upload-preset="nuxt-cloudinary-unsigned"
Expand Down

0 comments on commit 23f960d

Please sign in to comment.