diff --git a/src/components/Layout/Layout.js b/src/components/Layout/Layout.js
index 4ceeebc..1170d14 100644
--- a/src/components/Layout/Layout.js
+++ b/src/components/Layout/Layout.js
@@ -32,6 +32,10 @@ const layout = (props) => {
slideClasses.push('hideCursor');
}
+ const currentEndedPlayingHandler = () => {
+ props.currentEndedPlaying();
+ }
+
return (
@@ -78,7 +82,7 @@ const layout = (props) => {
- { link ? : null }
+ { link ? : null }
{ props.prev !== props.post ? : null }
);
diff --git a/src/components/Slide/Slide.js b/src/components/Slide/Slide.js
index 3094040..f818e31 100644
--- a/src/components/Slide/Slide.js
+++ b/src/components/Slide/Slide.js
@@ -1,8 +1,10 @@
-import React from 'react';
+import React, { useState } from 'react';
import './Slide.css'
-const slide = (props) => {
+const Slide = (props) => {
+ // how many time has the video played?
+ const [loopCount, setLoopCount] = useState(0);
// get file extension
const extPattern = /\.[0-9a-z]+$/i;
@@ -20,17 +22,26 @@ const slide = (props) => {
// const afterDomain = props.url.match(/[.0-9a-zA-Z]+$/)[0];
// console.log('afterdomain', afterDomain);
+ const endedHandler = () => {
+ if (props.classes.includes('current')) {
+ if (loopCount === 1 && props.currentEndedPLaying) {
+ props.currentEndedPLaying();
+ }
+ setLoopCount(loopCount + 1)
+ }
+ }
+
if (fileExt) {
// Imgur videos can be linked by using .mp4 extension instead of .gifv
if ( fileExt === ".gifv" ) {
return (
-