forked from Doenet/DoenetTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
857ca93
commit 2b646df
Showing
4 changed files
with
132 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React, { useEffect, useRef } from 'react'; | ||
import styled from "styled-components"; | ||
|
||
const HPVideo = styled.video` | ||
height: 350px; | ||
@media (max-width: 780px) { | ||
height: 240px; | ||
} | ||
@media (max-width: 450px) { | ||
height: 180px; | ||
} | ||
` | ||
|
||
export default function HomeIntroVideo(){ | ||
|
||
const videoEl = useRef(null); | ||
|
||
const attemptPlay = () => { | ||
videoEl && | ||
videoEl.current && | ||
videoEl.current.play().catch(error => { | ||
console.error("Error attempting to play", error); | ||
}); | ||
}; | ||
|
||
useEffect(() => { | ||
attemptPlay(); | ||
}, []); | ||
|
||
|
||
return <HPVideo | ||
// height='420px' | ||
fluid='false' | ||
// src='/media/homepagevideo2.mp4' | ||
// loop | ||
muted | ||
playsInline | ||
alt="Demonstration video on making DoenetML content" | ||
ref={videoEl} | ||
// autoplay | ||
controls | ||
><source src="/media/homepagevideo.mp4" type="video/mp4" /></HPVideo> | ||
} | ||
|
Oops, something went wrong.