MCPcopy Create free account
hub / github.com/Hrishikesh332/dev-ai / create_video_embed

Function create_video_embed

app.py:74–109  ·  view source on GitHub ↗
(video_url, start_time=0, end_time=0)

Source from the content-addressed store, hash-verified

72
73# Create an embedded video player with timestamp support
74def create_video_embed(video_url, start_time=0, end_time=0):
75 try:
76 if 'vimeo.com' in video_url:
77 video_id = video_url.split('/')[-1].split('?')[0]
78 start_seconds = str(int(float(start_time)))
79 return f"""
80 <iframe
81 width="100%"
82 height="315"
83 src="https://player.vimeo.com/video/{video_id}#t={start_seconds}s"
84 frameborder="0"
85 allow="fullscreen; picture-in-picture"
86 allowfullscreen>
87 </iframe>
88 """
89 else:
90 return f"""
91 <video
92 width="100%"
93 height="315"
94 controls
95 preload="auto"
96 id="video-player">
97 <source src="{video_url}" type="video/mp4">
98 Your browser does not support the video tag.
99 </video>
100 <script>
101 var video = document.getElementById('video-player');
102 video.addEventListener('loadedmetadata', function() {{
103 this.currentTime = {start_time};
104 }});
105 </script>
106 """
107 except Exception as e:
108 st.error(f"Error creating video embed: {str(e)}")
109 return f"<p>Error creating video embed for URL: {video_url}</p>"
110
111
112def render_product_details(source):

Callers 1

render_product_detailsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected