CaptionEditorTest / Functions /video_player_functions.py
maryna7679's picture
Error fix
9ab5181
raw
history blame
613 Bytes
import re
from Functions.db_connection import default_app
def youtube_link_to_id(link):
video_id = re.findall("=(.*?)&", link)
if len(video_id) == 0:
video_id = re.findall("=(.*)", link)
return video_id[0]
def get_video_embed_by_id(video_id):
return f"""
<div class="container">
<iframe src="https://www.youtube.com/embed/{video_id}" frameborder="0" allowfullscreen class="video"></iframe>
</div>"""
def get_video_link_by_pointer(pointer):
video_link = default_app.database().child("Videos").child(str(pointer)).get().val()
return video_link