Skip to content

Commit

Permalink
UX: Proof-of-concept for new video player #1307 #3372
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Mayer <michael@photoprism.app>
  • Loading branch information
lastzero committed Jun 19, 2023
1 parent df0d93b commit baeba38
Show file tree
Hide file tree
Showing 20 changed files with 1,642 additions and 126 deletions.
1 change: 1 addition & 0 deletions assets/static/video/plyr.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"mocha": "^10.2.0",
"node-storage-shim": "^2.0.1",
"photoswipe": "^4.1.3",
"plyr": "^3.7.8",
"postcss": "^8.4.20",
"postcss-import": "^15.1.0",
"postcss-loader": "^7.0.2",
Expand Down
26 changes: 10 additions & 16 deletions frontend/src/component/photo-viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@
</div>
</div>
<div v-if="player.show" class="video-viewer" @click.stop.prevent="closePlayer" @keydown.esc.stop.prevent="closePlayer">
<p-video-player ref="player" :source="player.source" :poster="player.poster"
:height="player.height" :width="player.width" :autoplay="player.autoplay" :loop="player.loop" @close="closePlayer">
</p-video-player>
<p-video-player ref="player" :videos="videos" :index="0" @close="closePlayer"></p-video-player>
</div>
</div>
</template>
Expand All @@ -101,13 +99,14 @@ export default {
canDownload: this.$config.allow("photos", "download") && this.$config.feature("download"),
selection: this.$clipboard.selection,
config: this.$config.values,
item: new Thumb(),
item: new Thumb(false),
subscriptions: [],
interval: false,
slideshow: {
active: false,
next: 0,
},
videos: [],
player: {
show: false,
loop: false,
Expand Down Expand Up @@ -175,28 +174,23 @@ export default {
},
onPlay() {
if (this.item && this.item.Playable) {
new Photo().find(this.item.UID).then((video) => this.openPlayer(video));
new Photo().find(this.item.UID).then((photo) => this.openPlayer(photo));
}
},
openPlayer(video) {
if (!video) {
openPlayer(photo) {
if (!photo) {
this.$notify.error(this.$gettext("No video selected"));
return;
}
const params = video.videoParams();
const video = photo.video();
if (params.error) {
this.$notify.error(params.error);
if (!video || video.Error) {
this.$notify.error(this.$gettext("Not Found"));
return;
}
// Set video parameters.
this.player.loop = params.loop;
this.player.width = params.width;
this.player.height = params.height;
this.player.poster = params.poster;
this.player.source = params.uri;
this.videos = [video];
// Play video.
this.player.show = true;
Expand Down
Loading

0 comments on commit baeba38

Please sign in to comment.