@@ -13,89 +13,85 @@ const playerOptions = {
1313} ;
1414
1515const srcConfig = {
16- src : ' https://ik.imagekit.io/a1yisxurxo/aman/ shoppable%20vidoes/shoppable_demo .mp4?updatedAt=1752633516273' ,
16+ src : " https://ik.imagekit.io/ikmedia/docs/video-player/ shoppable/video .mp4" ,
1717 shoppable : {
1818 products : [
1919 {
2020 productId : 1 ,
21- productName : 'Classic Aviators' ,
22- highlightTime : { start : 2 , end : 6 } , // Highlight from 0s to 6s
23- imageUrl :
24- 'https://ik.imagekit.io/a1yisxurxo/aman/shoppable%20vidoes/glasses3.jpeg?updatedAt=1752632518026' ,
21+ productName : "Classic Aviators" ,
22+ highlightTime : { start : 2 , end : 6 } ,
23+ imageUrl : "https://ik.imagekit.io/ikmedia/docs/video-player/shoppable/aviators.jpeg" ,
2524 hotspots : [
2625 {
27- time : ' 00:06' ,
28- x : '50%' ,
29- y : '25%' ,
30- tooltipPosition : ' left' ,
31- clickUrl : ' https://images.pexels.com/photos/701877/pexels-photo-701877.jpeg' ,
32- } ,
26+ time : " 00:06" ,
27+ x : "48%" ,
28+ y : "35%" ,
29+ tooltipPosition : " left" ,
30+ clickUrl : " https://images.pexels.com/photos/701877/pexels-photo-701877.jpeg"
31+ }
3332 ] ,
3433 onHover : {
35- action : ' overlay' ,
36- args : ' Click to see this product in the video' ,
34+ action : " overlay" ,
35+ args : " Click to see this product in the video"
3736 } ,
3837 onClick : {
39- action : ' seek' ,
38+ action : " seek" ,
4039 pause : 5 ,
41- args : { time : ' 00:06' } ,
42- } ,
40+ args : { time : " 00:06" }
41+ }
4342 } ,
4443 {
4544 productId : 2 ,
46- productName : 'Wooden frame glasses for personal use' ,
47- imageUrl :
48- 'https://ik.imagekit.io/a1yisxurxo/aman/shoppable%20vidoes/glasses2.jpeg?updatedAt=1752632501675' ,
45+ productName : "Wooden frame glasses" ,
46+ imageUrl : "https://ik.imagekit.io/ikmedia/docs/video-player/shoppable/wooden_frames.jpeg" ,
4947 onHover : {
50- action : ' switch' ,
48+ action : " switch" ,
5149 args : {
52- url : ' https://ik.imagekit.io/a1yisxurxo/aman/ shoppable%20vidoes/glasses .jpeg?updatedAt=1752632426600' ,
53- } ,
50+ url : " https://ik.imagekit.io/ikmedia/docs/video-player/ shoppable/wooden_frames .jpeg"
51+ }
5452 } ,
5553 onClick : {
56- action : ' goto' ,
54+ action : " goto" ,
5755 pause : true ,
5856 args : {
59- url : ' https://www.pexels.com/search/wooden%20glasses%20frames/' ,
60- } ,
61- } ,
57+ url : " https://www.pexels.com/search/wooden%20glasses%20frames/"
58+ }
59+ }
6260 } ,
6361 {
6462 productId : 3 ,
65- productName : 'Sunglasses' ,
66- imageUrl :
67- 'https://ik.imagekit.io/a1yisxurxo/aman/shoppable%20vidoes/sunglass.jpeg?updatedAt=1752633002810' ,
63+ productName : "Sunglasses" ,
64+ imageUrl : "https://ik.imagekit.io/ikmedia/docs/video-player/shoppable/sunglass.jpeg" ,
6865 onHover : {
69- action : ' overlay' ,
70- args : ' Click to go to website' ,
66+ action : " overlay" ,
67+ args : " Click to go to website"
7168 } ,
7269 onClick : {
73- action : ' goto' ,
70+ action : " goto" ,
7471 pause : true ,
7572 args : {
76- url : ' https://www.pexels.com/photo/red-lens-sunglasses-on-sand-near-sea-at-sunset-selective-focus-photography-46710/' ,
77- } ,
78- } ,
73+ url : " https://www.pexels.com/photo/red-lens-sunglasses-on-sand-near-sea-at-sunset-selective-focus-photography-46710/"
74+ }
75+ }
7976 } ,
8077 {
8178 productId : 4 ,
82- productName : 'Eye protection' ,
83- highlightTime : { start : 7 , end : 9 } , // Highlight from 0s to 6s
84- imageUrl :
85- 'https://ik.imagekit.io/a1yisxurxo/aman/shoppable%20vidoes/protection.jpeg?updatedAt=1752633320623' ,
79+ productName : "Eye protection" ,
80+ highlightTime : { start : 7 , end : 9 } ,
81+ imageUrl : "https://ik.imagekit.io/ikmedia/docs/video-player/shoppable/protection.jpeg" ,
8682 onClick : {
87- action : ' goto' ,
83+ action : " goto" ,
8884 pause : true ,
8985 args : {
90- url : ' https://www.pexels.com/photo/red-lens-sunglasses-on-sand-near-sea-at-sunset-selective-focus-photography-46710/' ,
91- } ,
92- } ,
93- } ,
86+ url : " https://www.pexels.com/photo/red-lens-sunglasses-on-sand-near-sea-at-sunset-selective-focus-photography-46710/"
87+ }
88+ }
89+ }
9490 ] ,
9591 showPostPlayOverlay : true ,
9692 autoClose : false ,
97- startState : ' open' ,
98- } ,
93+ startState : " open"
94+ }
9995} ;
10096
10197const codeToDisplay = buildPlayerInitCode ( {
@@ -107,5 +103,11 @@ const codeToDisplay = buildPlayerInitCode({
107103
108104document . getElementById ( 'code-display' ) ! . textContent = codeToDisplay . trim ( ) ;
109105
110- const player = videoPlayer ( 'player' , playerOptions ) ;
111- player . src ( srcConfig ) ;
106+ // Helper function to initialize players
107+ function initPlayer ( playerId : string , options : typeof playerOptions , config : typeof srcConfig ) {
108+ const player = videoPlayer ( playerId , options ) ;
109+ player . src ( config ) ;
110+ }
111+
112+ // Initialize all players
113+ initPlayer ( 'player' , playerOptions , srcConfig ) ;
0 commit comments