Skip to content

Commit

Permalink
Collide enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
GiovanH committed Feb 18, 2022
1 parent c5faed2 commit 2d6588f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/SpecialPages/EndOfHS.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</div>
<Footnotes :pageId="thisPage.pageId" preface />
<div class="vid">
<Media :url="thisPage.media[0]" />
<Media :url="thisPage.media[0]" autoplay="true" ref="embed" />
</div>
<div class="links">
<FlashCredit :pageId="thisPage.pageId" />
Expand Down
22 changes: 20 additions & 2 deletions src/components/UIElements/MediaEmbed.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<img v-if="getMediaType(url) === 'img'" :src='$getResourceURL(url)' @dragstart="drag($event)" alt />
<video v-else-if="getMediaType(url) ==='vid' && gifmode != undefined" :src='$getResourceURL(url)' :width="videoWidth" autoplay="true" muted="true" loop disablePictureInPicture />
<video v-else-if="getMediaType(url) ==='vid' && gifmode == undefined" :src='$getResourceURL(url)' :width="videoWidth" controls controlsList="nodownload" disablePictureInPicture alt />
<video v-else-if="getMediaType(url) ==='vid' && gifmode == undefined" :src='$getResourceURL(url)' :width="videoWidth" controls controlsList="nodownload" disablePictureInPicture alt :autoplay="autoplay" @loadeddata="onVideoLoaded" />
<iframe v-else-if="getMediaType(url) === 'swf'" :key="url" :srcdoc='flashSrc' :width='flashProps.width' :height='($localData.settings.jsFlashes && flashProps.id in cropHeight) ? cropHeight[flashProps.id] : flashProps.height' @load="initIframe()" seamless/>
<!-- HTML iframes must not point to assets :c -->

Expand All @@ -24,7 +24,7 @@ import Resources from "@/resources.js"
export default {
name: "MediaEmbed",
props: ['url', 'gifmode', 'webarchive'],
props: ['url', 'gifmode', 'webarchive', 'autoplay'],
emits: ['blockedevent'],
data() {
return {
Expand Down Expand Up @@ -215,6 +215,9 @@ export default {
'A6A6I1': -100,
'darkcage': 350,
},
pauseAt: {
"08080": 18
},
audio: [],
source: undefined,
lastStartedAudio: undefined,
Expand Down Expand Up @@ -311,6 +314,21 @@ export default {
}
},
methods: {
onVideoLoaded(event) {
const pauseAt = this.pauseAt[this.flashProps.id]
if (pauseAt) {
const pause = function(){
if (this.currentTime > pauseAt) {
console.log("pausing video at", this.currentTime)
this.controls = true
this.pause()
this.removeEventListener("timeupdate", pause)
}
}
event.srcElement.controls = false
event.srcElement.addEventListener("timeupdate", pause)
}
},
initHtmlFrame(event) {
if (this.frameType == 'webview') {
const webview = event.srcElement
Expand Down

0 comments on commit 2d6588f

Please sign in to comment.