@adactive/arc-carousel-asia
Advanced tools
Comparing version 2.3.2 to 2.3.3
{ | ||
"name": "@adactive/arc-carousel-asia", | ||
"version": "2.3.2", | ||
"version": "2.3.3", | ||
"description": "Adsum Carousel Component", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -48,3 +48,2 @@ // @flow | ||
}, | ||
dynamicAutoPlayInterval: false, | ||
style: {}, | ||
@@ -67,19 +66,14 @@ ButtonModalForImage: null, | ||
}; | ||
} | ||
componentDidMount() { | ||
const { setTimeoutSlide } = this.state; | ||
if (this._videoPlayers[0]) { | ||
if(setTimeoutSlide!==null) {clearTimeout(setTimeoutSlide)}; | ||
this.checkTimeOut(); | ||
this._videoPlayers[0].play(); | ||
if(autoSlide){ | ||
const firstVideoProp = this._videoPlayers[0].video.getProperties(); | ||
const firstconvertedVideoDuration = (parseInt(firstVideoProp.duration) + 1)*1000; | ||
this.setState({ | ||
setTimeoutSlide: setTimeout(() => { this.carousel.goToSlide(1); }, firstconvertedVideoDuration), | ||
}) | ||
} | ||
const firstVideoProp = this._videoPlayers[0].video.getProperties(); | ||
// eslint-disable-next-line radix | ||
const firstconvertedVideoDuration = (parseInt(firstVideoProp.duration) + 1) * 1000; | ||
this.makeItLoop(0, firstconvertedVideoDuration); | ||
} | ||
@@ -96,2 +90,24 @@ } | ||
makeItLoop = (id, someInterval) => { | ||
const { autoSlide } = this.props; | ||
if (autoSlide) { | ||
if (id === (this.carousel.state.slideCount - 1)) { | ||
this.setState({ | ||
setTimeoutSlide: setTimeout(() => { this.carousel.goToSlide(0); }, someInterval), | ||
}); | ||
} else { | ||
this.setState({ | ||
setTimeoutSlide: setTimeout(() => { this.carousel.goToSlide(id + 1); }, someInterval), | ||
}); | ||
} | ||
} | ||
} | ||
checkTimeOut = () => { | ||
const { setTimeoutSlide } = this.state; | ||
if (setTimeoutSlide !== null) { clearTimeout(setTimeoutSlide); } | ||
} | ||
/** | ||
@@ -102,4 +118,3 @@ * To play video immediately if the media is a video on slide change | ||
slideDidChange(id: number | string) { | ||
const { isOpen, autoSlide, autoSlideInterval } = this.props; | ||
const { setTimeoutSlide } = this.state; | ||
const { isOpen, autoSlideInterval } = this.props; | ||
@@ -109,38 +124,20 @@ if (!isOpen) return; | ||
if (this._videoPlayers[id]) { | ||
if(setTimeoutSlide!==null) {clearTimeout(setTimeoutSlide)}; | ||
this.checkTimeOut(); | ||
const videoProp = this._videoPlayers[id].video.getProperties(); | ||
const convertedVideoDuration = (parseInt(videoProp.duration) + 1)*1000; | ||
// eslint-disable-next-line radix | ||
const convertedVideoDuration = parseInt(videoProp.duration) * 1000; | ||
this._videoPlayers[id].play(); | ||
if(autoSlide){ | ||
if(id === (this.carousel.state.slideCount-1)){ | ||
this.setState({ | ||
setTimeoutSlide: setTimeout(() => { this.carousel.goToSlide(0); }, convertedVideoDuration), | ||
}) | ||
} else { | ||
this.setState({ | ||
setTimeoutSlide: setTimeout(() => { this.carousel.goToSlide(id+1); }, convertedVideoDuration), | ||
}) | ||
} | ||
} | ||
this.makeItLoop(id, convertedVideoDuration); | ||
} else { | ||
if(autoSlide){ | ||
if(setTimeoutSlide!==null) {clearTimeout(setTimeoutSlide)}; | ||
if(id === (this.carousel.state.slideCount-1)){ | ||
this.setState({ | ||
setTimeoutSlide: setTimeout(() => { this.carousel.goToSlide(0); }, autoSlideInterval), | ||
}) | ||
} else { | ||
this.setState({ | ||
setTimeoutSlide: setTimeout(() => { this.carousel.goToSlide(id+1); }, autoSlideInterval), | ||
}) | ||
} | ||
} | ||
this.checkTimeOut(); | ||
this.makeItLoop(id, autoSlideInterval); | ||
} | ||
} | ||
goToNextSlide() { | ||
null | ||
} | ||
/** | ||
@@ -175,2 +172,3 @@ * Create carousel slides content images or videos | ||
onPlayerInit={this.onPlayerInit} | ||
onVideoEnded={this.goToNextSlide} | ||
shouldReplayVideo={medias.length === 1 && (medias[0].file.file_type === 'video/mp4' || medias[0].file.file_type === 'video/x-m4v')} | ||
@@ -177,0 +175,0 @@ parentStyle={parentStyle} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20294
475