diff --git a/app/Http/Controllers/Views/Videos/VideoController.php b/app/Http/Controllers/Views/Videos/VideoController.php index 873fd9d74..bfca29e4e 100644 --- a/app/Http/Controllers/Views/Videos/VideoController.php +++ b/app/Http/Controllers/Views/Videos/VideoController.php @@ -72,15 +72,40 @@ public function show(Request $request, $id) 'too-large' => VIDEO::ERROR_TOO_LARGE, ]); - return view('videos.show', compact( - 'user', - 'video', - 'volume', - 'videos', - 'shapes', - 'labelTrees', - 'annotationSessions', - 'errors' - )); + $fileIds = $volume->orderedFiles()->pluck('uuid', 'id'); + + if ($volume->isImageVolume()) { + $thumbUriTemplate = thumbnail_url(':uuid'); + } else { + $thumbUriTemplate = thumbnail_url(':uuid', config('videos.thumbnail_storage_disk')); + } + + $spritesThumbnailsPerSprite = config('videos.sprites_thumbnails_per_sprite'); + $spritesThumbnailInterval = config('videos.sprites_thumbnail_interval'); + $spritesMaxThumbnails = config('videos.sprites_max_thumbnails'); + $spritesMinThumbnails = config('videos.sprites_min_thumbnails'); + $spritesThumbnailWidth = config('videos.sprites_thumbnail_width'); + $spritesThumbnailHeight = config('videos.sprites_thumbnail_height'); + return view( + 'videos.show', + compact( + 'user', + 'video', + 'volume', + 'videos', + 'shapes', + 'labelTrees', + 'annotationSessions', + 'errors', + 'fileIds', + 'thumbUriTemplate', + 'spritesThumbnailsPerSprite', + 'spritesThumbnailInterval', + 'spritesMaxThumbnails', + 'spritesMinThumbnails', + 'spritesThumbnailWidth', + 'spritesThumbnailHeight' + ) + ); } } diff --git a/resources/assets/js/videos/components/scrollStrip.vue b/resources/assets/js/videos/components/scrollStrip.vue index 4636cf5c2..a6a0fdf9f 100644 --- a/resources/assets/js/videos/components/scrollStrip.vue +++ b/resources/assets/js/videos/components/scrollStrip.vue @@ -10,10 +10,19 @@ :style="scrollerStyle" @mousemove="handleUpdateHoverTime" > +
this.initialElementWidth; }, + showThumbPreview() { + return this.showThumbnailPreview && this.showThumb; + } }, methods: { updateInitialElementWidth() { @@ -210,6 +232,14 @@ export default { this.hasOverflowTop = false; this.hasOverflowBottom = false; }, + handleVideoProgressMousemove(clientX) { + this.showThumb = true; + this.clientMouseX = clientX; + this.scrollstripTop = this.$refs.scroller.getBoundingClientRect().top; + }, + hideThumbnailPreview() { + this.showThumb = false; + }, }, watch: { hoverTime(time) { diff --git a/resources/assets/js/videos/components/settingsTab.vue b/resources/assets/js/videos/components/settingsTab.vue index 3932af765..f5d6c6d38 100644 --- a/resources/assets/js/videos/components/settingsTab.vue +++ b/resources/assets/js/videos/components/settingsTab.vue @@ -15,6 +15,7 @@ export default { 'showLabelTooltip', 'showMousePosition', 'showProgressIndicator', + 'showThumbnailPreview' ], annotationOpacity: 1, showMinimap: true, @@ -23,6 +24,7 @@ export default { showMousePosition: false, playbackRate: 1.0, showProgressIndicator: true, + showThumbnailPreview: true, }; }, methods: { @@ -50,6 +52,12 @@ export default { handleHideProgressIndicator() { this.showProgressIndicator = false; }, + handleShowThumbnailPreview() { + this.showThumbnailPreview = true; + }, + handleHideThumbnailPreview() { + this.showThumbnailPreview = false; + }, }, watch: { annotationOpacity(value) { @@ -86,6 +94,10 @@ export default { this.$emit('update', 'showProgressIndicator', show); Settings.set('showProgressIndicator', show); }, + showThumbnailPreview(show) { + this.$emit('update', 'showThumbnailPreview', show); + Settings.set('showThumbnailPreview', show); + }, }, created() { this.restoreKeys.forEach((key) => { diff --git a/resources/assets/js/videos/components/thumbnailPreview.vue b/resources/assets/js/videos/components/thumbnailPreview.vue new file mode 100644 index 000000000..121dbc59c --- /dev/null +++ b/resources/assets/js/videos/components/thumbnailPreview.vue @@ -0,0 +1,141 @@ + + + \ No newline at end of file diff --git a/resources/assets/js/videos/components/videoProgress.vue b/resources/assets/js/videos/components/videoProgress.vue index 0906a08ad..ec859d1cc 100644 --- a/resources/assets/js/videos/components/videoProgress.vue +++ b/resources/assets/js/videos/components/videoProgress.vue @@ -2,6 +2,8 @@
diff --git a/resources/assets/js/videos/components/videoTimeline.vue b/resources/assets/js/videos/components/videoTimeline.vue index d0329d8d2..fef6867d2 100644 --- a/resources/assets/js/videos/components/videoTimeline.vue +++ b/resources/assets/js/videos/components/videoTimeline.vue @@ -20,6 +20,7 @@ :duration="duration" :current-time="currentTime" :seeking="seeking" + :showThumbnailPreview="showThumbnailPreview" @seek="emitSeek" @select="emitSelect" @deselect="emitDeselect" @@ -65,6 +66,10 @@ export default { return null; }, }, + showThumbnailPreview: { + type: Boolean, + default: true, + }, }, data() { return { diff --git a/resources/assets/js/videos/main.js b/resources/assets/js/videos/main.js index 414c9ea6b..d415ad484 100644 --- a/resources/assets/js/videos/main.js +++ b/resources/assets/js/videos/main.js @@ -2,7 +2,8 @@ import './filters/videoTime'; import Navbar from './navbar'; import SearchResults from './searchResults'; import VideoContainer from './videoContainer'; - +import ThumbnailPreview from './components/thumbnailPreview'; biigle.$mount('search-results', SearchResults); biigle.$mount('video-annotations-navbar', Navbar); biigle.$mount('video-container', VideoContainer); +biigle.$mount('thumbnail-preview', ThumbnailPreview); \ No newline at end of file diff --git a/resources/assets/js/videos/stores/settings.js b/resources/assets/js/videos/stores/settings.js index 5a88bd2c4..589880ac3 100644 --- a/resources/assets/js/videos/stores/settings.js +++ b/resources/assets/js/videos/stores/settings.js @@ -7,6 +7,7 @@ let defaults = { showLabelTooltip: false, showMousePosition: false, showProgressIndicator: true, + showThumbnailPreview: true, }; export default new Settings({ diff --git a/resources/assets/js/videos/videoContainer.vue b/resources/assets/js/videos/videoContainer.vue index b1c905813..04f17523f 100644 --- a/resources/assets/js/videos/videoContainer.vue +++ b/resources/assets/js/videos/videoContainer.vue @@ -68,6 +68,7 @@ export default { showMousePosition: false, playbackRate: 1.0, showProgressIndicator: true, + showThumbnailPreview: true, }, openTab: '', urlParams: { diff --git a/resources/assets/sass/videos/components/_thumbnail.scss b/resources/assets/sass/videos/components/_thumbnail.scss new file mode 100644 index 000000000..efbc6ef8c --- /dev/null +++ b/resources/assets/sass/videos/components/_thumbnail.scss @@ -0,0 +1,10 @@ +.thumbnail-preview { + position: fixed; + z-index: 1; +} + +.thumbnail-canvas { + @extend %info-box; + padding: 0; + box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25); +} \ No newline at end of file diff --git a/resources/assets/sass/videos/main.scss b/resources/assets/sass/videos/main.scss index 35aade99b..51c588646 100644 --- a/resources/assets/sass/videos/main.scss +++ b/resources/assets/sass/videos/main.scss @@ -53,3 +53,4 @@ @import 'components/annotationClip'; @import 'components/annotationSegment'; @import 'components/annotationKeyframe'; +@import 'components/thumbnail'; \ No newline at end of file diff --git a/resources/views/videos/show.blade.php b/resources/views/videos/show.blade.php index 09e3164a5..5d666ce6e 100644 --- a/resources/views/videos/show.blade.php +++ b/resources/views/videos/show.blade.php @@ -69,5 +69,13 @@ class="sidebar-container__content" biigle.$declare('videos.videoFilenames', {!! $videos->values() !!}); biigle.$declare('videos.user', {!! $user !!}); biigle.$declare('videos.isAdmin', @can('update', $volume) true @else false @endcan); + biigle.$declare('videos.fileUuids', {!! $fileIds !!}); + biigle.$declare('videos.thumbUri', '{{ $thumbUriTemplate }}'); + biigle.$declare('videos.spritesThumbnailsPerSprite', {!! $spritesThumbnailsPerSprite !!}); + biigle.$declare('videos.spritesThumbnailInterval', {!! $spritesThumbnailInterval !!}); + biigle.$declare('videos.spritesMaxThumbnails', {!! $spritesMaxThumbnails !!}); + biigle.$declare('videos.spritesMinThumbnails', {!! $spritesMinThumbnails !!}); + biigle.$declare('videos.spritesThumbnailWidth', {!! $spritesThumbnailWidth !!}); + biigle.$declare('videos.spritesThumbnailHeight', {!! $spritesThumbnailHeight !!}); @endpush diff --git a/resources/views/videos/show/content.blade.php b/resources/views/videos/show/content.blade.php index b6cf7a816..9f9f15d79 100644 --- a/resources/views/videos/show/content.blade.php +++ b/resources/views/videos/show/content.blade.php @@ -69,6 +69,7 @@ :seeking="seeking" :height-offset="timelineHeightOffset" :pending-annotation="pendingAnnotation" + :show-thumbnail-preview="settings.showThumbnailPreview" v-on:seek="seek" v-on:select="selectAnnotation" v-on:deselect="deselectAnnotation" diff --git a/resources/views/videos/show/sidebar-settings.blade.php b/resources/views/videos/show/sidebar-settings.blade.php index f77eb6e4c..dec80fe3c 100644 --- a/resources/views/videos/show/sidebar-settings.blade.php +++ b/resources/views/videos/show/sidebar-settings.blade.php @@ -35,6 +35,9 @@ Mouse Position
+