Video records API
This commit is contained in:
@@ -5,7 +5,7 @@ import API from '../API';
|
||||
import { useSnapshot } from 'valtio';
|
||||
import GlobalState from '../contexts/GlobalState.js';
|
||||
|
||||
const VideoPlayer = ({ videosFiles, postId, poster, videoUrl, videoStyle }) => {
|
||||
const VideoPlayer = ({ videosFiles, postId, profileId, poster, videoUrl, videoStyle }) => {
|
||||
const gState = useSnapshot(GlobalState);
|
||||
const viewer = gState.me;
|
||||
const video = React.useRef(null);
|
||||
@@ -28,7 +28,23 @@ const VideoPlayer = ({ videosFiles, postId, poster, videoUrl, videoStyle }) => {
|
||||
if(!viewer.data[postId]) return 0;
|
||||
console.log(postId + " loaded")
|
||||
video.current.setPositionAsync(viewer.data[postId].time*1000);
|
||||
video.current.presentFullscreenPlayer();
|
||||
};
|
||||
|
||||
//console.log("status", status)
|
||||
if(postId && status.isPlaying){
|
||||
const ts = new Date();
|
||||
const newData = {
|
||||
watched: status.didJustFinish,
|
||||
time: Math.round(status.positionMillis/1000),
|
||||
ts: ts.getTime(),
|
||||
duration: Math.round(status.durationMillis/1000),
|
||||
postId: postId,
|
||||
profileId: profileId,
|
||||
};
|
||||
console.log(postId, newData);
|
||||
API.setDataValue(postId, newData);
|
||||
}
|
||||
|
||||
return (
|
||||
<Video
|
||||
|
||||
Reference in New Issue
Block a user