<video
id="player"
width="250"
controls
muted
class="cld-video-player">
</video>
var player = cloudinary.videoPlayer('player',{
cloud_name: 'demo',
bigPlayButton: false
});
var sources = {
top:'https://res.cloudinary.com/eran2903/video/upload/w_880,x_800,y_200,c_crop/w_270,eo_8,q_auto:best,f_auto/production_ID_3888264_fuuo7c.mp4',
middle:'https://www2.hm.com/en_in/productpage.0687948004.html',
bottom:'https://res.cloudinary.com/eran2903/video/upload/w_540,x_1260,y_3100,c_crop/w_270,eo_8,q_auto:best,f_auto/production_ID_3888264_fuuo7c.mp4'
}
player.source('video-player/girl_in_a_dress', {
interactionAreas: {
enable: true,
template: 'portrait', // or landscape/all/center
onClick: function(event) {
// 'event.item.id' is an id that been defined in the vtt file
var src = sources[event.item.id];
if(event.item.id === 'middle'){
if(window.confirm("Do you like this shirt ?")) {
window.open(src, '_blank').focus();
}
}
else {
event.zoom(src)
}
}
}
});
Using your own VTT file
<video
id="player"
width="250"
controls
muted
class="cld-video-player">
</video>
var player = cloudinary.videoPlayer('player',{
cloud_name: 'demo',
bigPlayButton: false
});
var sources = {
center : 'https://res.cloudinary.com/eran2903/video/upload/w_880,x_800,y_200,c_crop/w_270,eo_8,q_auto:best,f_auto/production_ID_3888264_fuuo7c.mp4'
}
player.source('video-player/girl_in_a_dress', {
interactionAreas: {
enable: true,
vttUrl: 'https://res.cloudinary.com/prod/raw/upload/v1623250265/video-player/vtts/center.vtt',
onClick: function(event) {
// 'event.item.id' is an id that been defined in the vtt file
event.zoom(sources[event.item.id]);
}
}
});
Auto-zoom video cropping
<video
id="player"
controls
muted
class="cld-video-player">
</video>
var player = cloudinary.videoPlayer('player', {
cloud_name: 'demo',
bigPlayButton: false
});
// auto-zoom works only if the source is a cloudinary source object or a public id
// does not work for a full raw url
player.source('video-player/girl_in_a_dress', {
transformation:{
quality: 'auto',
},
interactionAreas: {
enable: true,
template: 'portrait',
onClick: function (event) {
//in case you not passing a source to the zoom function auto zoom will be enabled
event.zoom();
}
}
});