embeds?
This commit is contained in:
parent
2fdb3fd7f8
commit
2318d22f38
@ -85,8 +85,13 @@ const Media = () => {
|
|||||||
if (response.status !== 200) return console.error('Failed to get clip index');
|
if (response.status !== 200) return console.error('Failed to get clip index');
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
updateIndex(data);
|
updateIndex(data);
|
||||||
if (location.hash) {
|
// if (location.hash) {
|
||||||
const video = data.find(vid => `#${vid.name.toLowerCase()}` === location.hash.toLowerCase());
|
// const video = data.find(vid => `#${vid.name.toLowerCase()}` === location.hash.toLowerCase());
|
||||||
|
// if (video) setVideo(video);
|
||||||
|
// }
|
||||||
|
const [, , videoname] = location.pathname.toLowerCase().split('/');
|
||||||
|
if (videoname) {
|
||||||
|
const video = data.find(vid => vid.name.toLowerCase() === videoname);
|
||||||
if (video) setVideo(video);
|
if (video) setVideo(video);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
@ -95,12 +100,22 @@ const Media = () => {
|
|||||||
|
|
||||||
const clickHandler = (video) => {
|
const clickHandler = (video) => {
|
||||||
setVideo(video);
|
setVideo(video);
|
||||||
navigate(`#${video.name}`);
|
//navigate(`#${video.name}`);
|
||||||
|
navigate(`/media/${video.name}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
let i = 0;
|
let i = 0;
|
||||||
return (
|
return (
|
||||||
<div className='media-page'>
|
<div className='media-page'>
|
||||||
|
|
||||||
|
<Helmet>
|
||||||
|
<title>V i d e o s</title>
|
||||||
|
<meta
|
||||||
|
name="description"
|
||||||
|
content="Page where I upload clips n stuff"
|
||||||
|
/>
|
||||||
|
</Helmet>
|
||||||
|
|
||||||
{index.map(entry => <ClipEntry clickHandler={() => clickHandler(entry)} key={i++} {...entry} />)}
|
{index.map(entry => <ClipEntry clickHandler={() => clickHandler(entry)} key={i++} {...entry} />)}
|
||||||
{video ? <VideoPlayer refF={ref} video={video} />:''}
|
{video ? <VideoPlayer refF={ref} video={video} />:''}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user