Skip to content

Commit

Permalink
Don't pause video upon modal open (Chocobozzz#3909)
Browse files Browse the repository at this point in the history
* client: dont pause video upon modal open

closes Chocobozzz#3816

* client(video/watch): remove obsolete code

* gitignore: add vscode and vim swp files
  • Loading branch information
kontrollanten committed Apr 9, 2021
1 parent 29b7b59 commit 5f3cf2e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ yarn-error.log
# IDE
/*.sublime-project
/*.sublime-workspace
/*.vscode
/**/.idea
/dist
/PeerTube.iml
*.swp

# Zanata
/.zanata-cache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ <h1 class="video-info-name">{{ video.name }}</h1>
<ng-container *ngIf="isUserLoggedIn()">
<my-video-actions-dropdown
placement="bottom auto" buttonDirection="horizontal" [buttonStyled]="true" [video]="video" [videoCaptions]="videoCaptions"
[displayOptions]="videoActionsOptions" (videoRemoved)="onVideoRemoved()" (modalOpened)="onModalOpened()"
[displayOptions]="videoActionsOptions" (videoRemoved)="onVideoRemoved()"
></my-video-actions-dropdown>
</ng-container>
</div>
Expand Down
37 changes: 1 addition & 36 deletions client/src/app/+videos/+video-watch/video-watch.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,23 +279,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
}

showSupportModal () {
// Check video was playing before opening support modal
const isVideoPlaying = this.isPlaying()

this.pausePlayer()

const modalRef = this.videoSupportModal.show()

modalRef.result.then(() => {
if (isVideoPlaying) {
this.resumePlayer()
}
})
this.videoSupportModal.show()
}

showShareModal () {
this.pausePlayer()

this.videoShareModal.show(this.currentTime, this.videoWatchPlaylist.currentPlaylistPosition)
}

Expand All @@ -318,10 +305,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
}
}

onModalOpened () {
this.pausePlayer()
}

onVideoRemoved () {
this.redirectService.redirectToHomepage()
}
Expand Down Expand Up @@ -873,24 +856,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
return { playerMode: mode, playerOptions: options }
}

private pausePlayer () {
if (!this.player) return

this.player.pause()
}

private resumePlayer () {
if (!this.player) return

this.player.play()
}

private isPlaying () {
if (!this.player) return

return !this.player.paused()
}

private async subscribeToLiveEventsIfNeeded (oldVideo: VideoDetails, newVideo: VideoDetails) {
if (!this.liveVideosSub) {
this.liveVideosSub = this.buildLiveEventsSubscription()
Expand Down

0 comments on commit 5f3cf2e

Please sign in to comment.