aboutsummaryrefslogtreecommitdiff
path: root/src/components/flash/flash.js
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2021-04-12 00:00:23 +0300
committerHenry Jameson <me@hjkos.com>2021-04-12 00:00:23 +0300
commitadafae977a5cc2b5ce1e3ab044bc17c4d4f11a4e (patch)
treed00c837758f632be9511100e3b119f4e9d2975ae /src/components/flash/flash.js
parent2f549774ab6f7dae08ad1cc5977cbf74b86e6d78 (diff)
Play-on-click, layout improvements.
Diffstat (limited to 'src/components/flash/flash.js')
-rw-r--r--src/components/flash/flash.js36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/components/flash/flash.js b/src/components/flash/flash.js
index e707a4c4..832705a2 100644
--- a/src/components/flash/flash.js
+++ b/src/components/flash/flash.js
@@ -1,16 +1,44 @@
import RuffleService from '../../services/ruffle_service/ruffle_service.js'
+import { library } from '@fortawesome/fontawesome-svg-core'
+import { faStop } from '@fortawesome/free-solid-svg-icons'
+
+library.add(
+ faStop,
+)
const Flash = {
props: [ 'src' ],
- created () {
- this.$nextTick(function () {
+ data () {
+ return {
+ player: false, // can be true, "hidden", false. hidden = element exists
+ loaded: false,
+ ruffleInstance: null
+ }
+ },
+ methods: {
+ openPlayer () {
+ if (this.player) return // prevent double-loading
+ this.player = 'hidden'
RuffleService.getRuffle().then((ruffle) => {
const player = ruffle.newest().createPlayer()
+ player.config = {
+ letterbox: 'on'
+ }
const container = this.$refs.cunt
container.appendChild(player)
- player.load(this.src)
+ player.style.width = '100%'
+ player.style.height = '100%'
+ player.load(this.src).then(() => {
+ this.player = true
+ })
+ this.ruffleInstance = player
})
- })
+ },
+ closePlayer () {
+ console.log(this.ruffleInstance)
+ this.ruffleInstance.remove()
+ this.player = false
+ }
}
}