Valtio and new tab menu
This commit is contained in:
@@ -2,38 +2,27 @@ import * as React from 'react';
|
||||
import { View, StyleSheet, Button } from 'react-native';
|
||||
import { Video, AVPlaybackStatus } from 'expo-av';
|
||||
import API from '../API';
|
||||
import { useSnapshot } from 'valtio';
|
||||
import GlobalState from '../contexts/GlobalState.js';
|
||||
|
||||
const VideoPlayer = ({ videosFiles, videoId }) => {
|
||||
//console.log(videosFiles)
|
||||
let chosenVideo = []; //rendition
|
||||
const gState = useSnapshot(GlobalState);
|
||||
const viewer = gState.me;
|
||||
let chosenVideo = [];
|
||||
videosFiles.forEach((f) => {
|
||||
if (f.rendition === 'adaptive') chosenVideo.push(f);
|
||||
});
|
||||
const video = React.useRef(null);
|
||||
const [status, setStatus] = React.useState({});
|
||||
const [Me, setMeProfile] = React.useState({});
|
||||
|
||||
React.useEffect( async ()=>{
|
||||
await API.getMe().then(setMeProfile);
|
||||
setTimeout(()=>{
|
||||
if(Me.data && Me.data[videoId]){
|
||||
//video.setPositionAsync(Me.data[videoId].time*1000);
|
||||
//status.positionMillis = Me.data[videoId].time*1000;
|
||||
//setStatus({...status});
|
||||
video.current.setPositionAsync(Me.data[videoId].time*1000);
|
||||
if(viewer.data && viewer.data[videoId]){
|
||||
video.current.setPositionAsync(viewer.data[videoId].time*1000);
|
||||
}
|
||||
|
||||
//status.isPlaying = true;
|
||||
|
||||
//playAsync();
|
||||
|
||||
}, 5000)
|
||||
}, 5000);
|
||||
}, [])
|
||||
|
||||
console.log(status)
|
||||
|
||||
//console.log(status)
|
||||
|
||||
return (
|
||||
<Video
|
||||
ref={video}
|
||||
|
||||
Reference in New Issue
Block a user