mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-03 18:01:39 +00:00
41 lines
18 KiB
Go
41 lines
18 KiB
Go
// Code generated by templ - DO NOT EDIT.
|
|||
|
|
|
||
|
|
// templ: version: v0.2.778
|
||
|
|
package blocks
|
||
|
|
|
||
|
|
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||
|
|
|
||
|
|
import "github.com/a-h/templ"
|
||
|
|
import templruntime "github.com/a-h/templ/runtime"
|
||
|
|
|
||
|
|
func Video() templ.Component {
|
||
|
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||
|
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||
|
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||
|
|
return templ_7745c5c3_CtxErr
|
||
|
|
}
|
||
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||
|
|
if !templ_7745c5c3_IsBuffer {
|
||
|
|
defer func() {
|
||
|
|
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||
|
|
if templ_7745c5c3_Err == nil {
|
||
|
|
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||
|
|
}
|
||
|
|
}()
|
||
|
|
}
|
||
|
|
ctx = templ.InitializeContext(ctx)
|
||
|
|
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||
|
|
if templ_7745c5c3_Var1 == nil {
|
||
|
|
templ_7745c5c3_Var1 = templ.NopComponent
|
||
|
|
}
|
||
|
|
ctx = templ.ClearChildren(ctx)
|
||
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div x-data=\"{\n sources: {\n mp4: 'https://cdn.devdojo.com/pines/videos/coast.mp4',\n webm: 'https://cdn.devdojo.com/pines/videos/coast.webm',\n ogg: 'https://cdn.devdojo.com/pines/videos/coast.ogg'\n },\n playing: false,\n controls: true,\n muted: false,\n muteForced: false,\n fullscreen: false,\n ended: false,\n mouseleave: false,\n autoHideControlsDelay: 3000,\n controlsHideTimeout: null,\n poster: null,\n videoDuration: 0,\n timeDurationString: '00:00',\n timeElapsedString: '00:00',\n showTime: false,\n volume: 1,\n volumeBeforeMute: 1,\n videoPlayerReady: false,\n timelineSeek(e) {\n time = this.formatTime(Math.round(e.target.value));\n this.timeElapsedString = `${time.minutes}:${time.seconds}`;\n },\n metaDataLoaded(event) {\n this.videoDuration = event.target.duration;\n this.$refs.videoProgress.setAttribute('max', this.videoDuration);\n\n time = this.formatTime(Math.round(this.videoDuration));\n this.timeDurationString = `${time.minutes}:${time.seconds}`;\n this.showTime = true;\n this.videoPlayerReady = true;\n },\n togglePlay(e) {\n if (this.$refs.player.paused || this.$refs.player.ended) {\n this.playing = true;\n this.$refs.player.play();\n } else {\n this.$refs.player.pause();\n this.playing = false;\n }\n },\n toggleMute(){\n this.muted = !this.muted;\n this.$refs.player.muted = this.muted;\n if(this.muted){\n this.volumeBeforeMute = this.volume;\n this.volume = 0;\n } else {\n this.volume = this.volumeBeforeMute;\n }\n },\n timeUpdatedInterval() {\n if (!this.$refs.videoProgress.getAttribute('max'))\n this.$refs.videoProgress.setAttribute('max', $refs.player.duration);\n this.$refs.videoProgress.value = this.$refs.player.currentTime;\n time = this.formatTime(Math.round(this.$refs.player.currentTime));\n this.timeElapsedString = `${time.minutes}:${time.seconds}`;\n },\n updateVolume(e) {\n this.volume = e.target.value;\n this.$refs.player.volume = this.volume;\n if(this.volume == 0){\n this.muted = true;\n }\n\n if(this.muted && this.volume > 0){\n this.muted = false;\n }\n },\n timelineClicked(e) {\n rect = this.$refs.videoProgress.getBoundingClientRect();\n pos = (e.pageX - rect.left) / this.$refs.videoProgress.offsetWidth;\n this.$refs.player.currentTime = pos * this.$refs.player.duration;\n },\n handleFullscreen() {\n if (document.fullscreenElement !== null) {\n // The document is in fullscreen mode\n document.exitFullscreen();\n } else {\n // The document is not in fullscreen mode\n this.$refs.videoContainer.requestFullscreen();\n }\n },\n mousemoveVideo() {\n if(this.playing){\n this.resetControlsTimeout();\n } else {\n this.controls=true;\n clearTimeout(this.controlsHideTimeout);\n }\n },\n videoEnded() {\n this.ended = true;\n this.playing = false;\n this.$refs.player.currentTime = 0;\n },\n resetControlsTimeout() {\n this.controls = true;\n clearTimeout(this.controlsHideTimeout);\n let that = this;\n this.controlsHideTimeout = setTimeout(fu
|
||
|
|
if templ_7745c5c3_Err != nil {
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
}
|
||
|
|
return templ_7745c5c3_Err
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
var _ = templruntime.GeneratedTemplate
|