import streamlit as st import base64 from streamlit.components.v1 import html st.title("Video Player App") video_file_path = "D:\\huggingface\\KHome\\digitalhuman.mp4" # 读取视频文件的内容 with open(video_file_path, "rb") as video_file: video_bytes = video_file.read() video_base64 = base64.b64encode(video_bytes).decode('utf-8') STOPPED_STATE = f""" """ PLAYING_STATE = f""" """ playstate = st.session_state.get("playstate") if not playstate: playstate = STOPPED_STATE st.markdown(playstate, unsafe_allow_html=True) # 播放按钮 if st.button("Play"): st.session_state["playstate"] = PLAYING_STATE # 暂停按钮 if st.button("Pause"): st.session_state["playstate"] = STOPPED_STATE