Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New video tag #107

Merged
merged 4 commits into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/charts/allCharts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import scatter from './scatter.vue'
import text from './text.vue'
import transit from './transit.vue'
import vega from './vega.vue'
import video from './video.vue'

// full-screen map visualizations:
import aggregate from './aggregate.vue'
Expand All @@ -37,6 +38,7 @@ export const plotlyCharts = {
transit,
scatter,
vega,
video,
}

// export all remaining charts/maps here:
Expand Down
73 changes: 73 additions & 0 deletions src/charts/video.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<template lang="pug">

figure(class="video_container")

video(:controls="controls" :loop='loop' :allowfullscreen='allowfullscreen')

source(v-for="(src, type) in sources" :src="src" :type="type" :key="type")

p(v-for="(src, type) in sources" :key="type") Video tag not supported. Download the video&nbsp;
a(:href="src" target="_blank") here

</template>

<script lang="ts">
import { Vue, Component, Watch, Prop } from 'vue-property-decorator'
import { FileSystemConfig } from '@/Globals'
import HTTPFileSystem from '@/js/HTTPFileSystem'
@Component({})
export default class VueComponent extends Vue {
@Prop({ required: true }) fileSystemConfig!: FileSystemConfig
@Prop({ required: true }) subfolder!: string
@Prop({ required: true }) files!: string[]
@Prop({ required: true }) config!: any
private controls: string | null = null
private loop: string | null = null
private allowfullscreen: string | null = null
private sources: { [key: string]: string } = {}
// true for absolute URLs
private r: RegExp = new RegExp('^(?:[a-z]+:)?//', 'i')
private async mounted() {
this.controls = this.config.controls
this.loop = this.config.loop
this.allowfullscreen = this.config.allowfullscreen
this.sources = {}
const fileApi = new HTTPFileSystem(this.fileSystemConfig)
// Resolve relative URLs
for (const k in this.config.sources) {
var url = this.config.sources[k]
if (!this.r.test(url)) url = fileApi.cleanURL(`${this.subfolder}/${url}`)
this.sources[k] = url
}
this.$emit('isLoaded')
}
}
</script>

<style scoped lang="scss">
@import '@/styles.scss';
.dash-element {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: flex;
flex-direction: column;
}
@media only screen and (max-width: 640px) {
}
</style>