Skip to content
Commits on Source (2)
...@@ -218,7 +218,7 @@ m-hashtags--sidebar-selector { ...@@ -218,7 +218,7 @@ m-hashtags--sidebar-selector {
width: 48px; width: 48px;
z-index: 1; z-index: 1;
@include m-theme(){ @include m-theme(){
background: linear-gradient(to right, rgba(themed($m-white-always), 0) 0%, rgba(themed($m-body-bg), 1) 50%); background: linear-gradient(to right, rgba(themed($m-white), 0) 0%, rgba(themed($m-body-bg), 1) 50%);
} }
.m-hashtagsSidebarSelectorCompactListOverflow__Arrow { .m-hashtagsSidebarSelectorCompactListOverflow__Arrow {
......
...@@ -175,7 +175,7 @@ ...@@ -175,7 +175,7 @@
[torrent]="[{ res: '360', key: activity.custom_data.guid + '/360.mp4' }]" [torrent]="[{ res: '360', key: activity.custom_data.guid + '/360.mp4' }]"
[isActivity]="true" [isActivity]="true"
(videoMetadataLoaded)="setVideoDimensions($event)" (videoMetadataLoaded)="setVideoDimensions($event)"
(mediaModalRequested)="showMediaModal()" (mediaModalRequested)="clickedVideo()"
#player> #player>
<video-ads [player]="player" *ngIf="activity.monetized"></video-ads> <video-ads [player]="player" *ngIf="activity.monetized"></video-ads>
</m-video> </m-video>
...@@ -212,7 +212,7 @@ ...@@ -212,7 +212,7 @@
style="width:100%" style="width:100%"
(error)="activity.custom_data[0].src = minds.cdn_assets_url + 'assets/logos/placeholder-bulb.jpg'" (error)="activity.custom_data[0].src = minds.cdn_assets_url + 'assets/logos/placeholder-bulb.jpg'"
*ngIf="activity.custom_data" *ngIf="activity.custom_data"
(click)="showMediaModal()" (click)="clickedImage()"
#batchImage #batchImage
> >
</a> </a>
......
...@@ -449,34 +449,45 @@ export class Activity implements OnInit { ...@@ -449,34 +449,45 @@ export class Activity implements OnInit {
this.activity.custom_data[0].height = img.naturalHeight; this.activity.custom_data[0].height = img.naturalHeight;
} }
showMediaModal() { clickedImage() {
if (this.featuresService.has('media-modal')) { // Check if is mobile (not tablet)
// Mobile (not tablet) users go to media page instead of modal if (isMobile() && Math.min(screen.width, screen.height) < 768) {
if (isMobile() && Math.min(screen.width, screen.height) < 768) { this.goToMediaPage();
this.router.navigate([`/media/${this.activity.entity_guid}`]); return;
} }
if (this.activity.custom_type === 'video') {
this.activity.custom_data.dimensions = this.videoDimensions;
} else { // Image
// Set image dimensions if they're not already there
if (this.activity.custom_data[0].width === '0' || this.activity.custom_data[0].height === '0') {
this.setImageDimensions();
}
}
this.activity.modal_source_url = this.router.url;
this.overlayModal.create(MediaModalComponent, this.activity, { if (!this.featuresService.has('media-modal')) {
class: 'm-overlayModal--media' // Non-canary
}).present(); this.goToMediaPage();
return;
} else { } else {
if (this.activity.custom_type !== 'video'){ // Canary
this.router.navigate([`/media/${this.activity.entity_guid}`]); if (this.activity.custom_data[0].width === '0' || this.activity.custom_data[0].height === '0') {
this.setImageDimensions();
} }
this.openModal();
} }
} }
clickedVideo() {
// Already filtered out mobile users/non-canary in video.component.ts
// So this is just applicable to desktop/tablet in canary and should always show modal
this.activity.custom_data.dimensions = this.videoDimensions;
this.openModal();
}
openModal() {
this.activity.modal_source_url = this.router.url;
this.overlayModal.create(MediaModalComponent, this.activity, {
class: 'm-overlayModal--media'
}).present();
}
goToMediaPage() {
this.router.navigate([`/media/${this.activity.entity_guid}`]);
}
detectChanges() { detectChanges() {
this.cd.markForCheck(); this.cd.markForCheck();
this.cd.detectChanges(); this.cd.detectChanges();
......
...@@ -159,31 +159,40 @@ export class Remind { ...@@ -159,31 +159,40 @@ export class Remind {
this.activity.custom_data[0].height = img.naturalHeight; this.activity.custom_data[0].height = img.naturalHeight;
} }
showMediaModal() { clickedImage() {
if (this.featuresService.has('media-modal')) { // Check if is mobile (not tablet)
// Mobile (not tablet) users go to media page instead of modal if (isMobile() && Math.min(screen.width, screen.height) < 768) {
if (isMobile() && Math.min(screen.width, screen.height) < 768) { this.goToMediaPage();
this.router.navigate([`/media/${this.activity.entity_guid}`]); }
}
if (this.activity.custom_type === 'video') {
this.activity.custom_data.dimensions = this.videoDimensions;
} else { // Image
// Set image dimensions if they're not already there
if (this.activity.custom_data[0].width === '0' || this.activity.custom_data[0].height === '0') {
this.setImageDimensions();
}
}
this.activity.modal_source_url = this.router.url;
this.overlayModal.create(MediaModalComponent, this.activity, { if (!this.featuresService.has('media-modal')) {
class: 'm-overlayModal--media' // Non-canary
}).present(); this.goToMediaPage();
} else { } else {
if (this.activity.custom_type !== 'video') { // Canary
this.router.navigate([`/media/${this.activity.entity_guid}`]); if (this.activity.custom_data[0].width === '0' || this.activity.custom_data[0].height === '0') {
this.setImageDimensions();
} }
this.openModal();
} }
} }
clickedVideo() {
// Already filtered out mobile users/non-canary in video.component.ts
// So this is just applicable to desktop/tablet in canary and should always show modal
this.activity.custom_data.dimensions = this.videoDimensions;
this.openModal();
}
openModal() {
this.activity.modal_source_url = this.router.url;
this.overlayModal.create(MediaModalComponent, this.activity, {
class: 'm-overlayModal--media'
}).present();
}
goToMediaPage() {
this.router.navigate([`/media/${this.activity.entity_guid}`]);
}
} }
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
(onError)="onError()" (onError)="onError()"
(onCanPlayThrough)="onCanPlayThrough()" (onCanPlayThrough)="onCanPlayThrough()"
(onLoadedMetadata)="loadedMetadata()" (onLoadedMetadata)="loadedMetadata()"
(click)="isModal ? toggle() : requestMediaModal()" (click)="clickedVideo()"
#player #player
></m-video--direct-http-player> ></m-video--direct-http-player>
...@@ -29,14 +29,14 @@ ...@@ -29,14 +29,14 @@
(onError)="onError()" (onError)="onError()"
(onCanPlayThrough)="onCanPlayThrough()" (onCanPlayThrough)="onCanPlayThrough()"
(onLoadedMetadata)="loadedMetadata()" (onLoadedMetadata)="loadedMetadata()"
(click)="isModal ? toggle() : requestMediaModal()" (click)="clickedVideo()"
#player #player
></m-video--torrent-player> ></m-video--torrent-player>
<ng-container *ngIf="playerRef"> <ng-container *ngIf="playerRef">
<i *ngIf="(!playerRef.isPlaying() && !playerRef.isLoading()) || (isActivity && metadataLoaded && !playerRef.isPlaying())" <i *ngIf="(!playerRef.isPlaying() && !playerRef.isLoading()) || (isActivity && metadataLoaded && !playerRef.isPlaying())"
class="material-icons minds-video-play-icon" class="material-icons minds-video-play-icon"
(click)="isModal ? toggle() : requestMediaModal()" (click)="clickedVideo()"
>play_circle_outline</i> >play_circle_outline</i>
<ng-content></ng-content> <ng-content></ng-content>
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
(select)="selectedQuality($event)" (select)="selectedQuality($event)"
></m-video--quality-selector> ></m-video--quality-selector>
<i *ngIf="!isModal" class="material-icons" (click)="playerRef.requestFullScreen()">tv</i> <i *ngIf="!isModal && !isActivity" class="material-icons" (click)="toggleFullscreen($event)">tv</i>
</div> </div>
<div class="m-video--torrent-info" *ngIf="torrentInfo && current.type === 'torrent'"> <div class="m-video--torrent-info" *ngIf="torrentInfo && current.type === 'torrent'">
......
...@@ -86,6 +86,7 @@ export class MindsVideoComponent implements OnDestroy { ...@@ -86,6 +86,7 @@ export class MindsVideoComponent implements OnDestroy {
metadataLoaded: boolean = false; metadataLoaded: boolean = false;
canPlayThrough: boolean = false; canPlayThrough: boolean = false;
isFullscreen: boolean = false; isFullscreen: boolean = false;
isMobile: boolean = false;
current: { type: 'torrent' | 'direct-http', src: string }; current: { type: 'torrent' | 'direct-http', src: string };
protected candidates: SourceCandidates = new SourceCandidates(); protected candidates: SourceCandidates = new SourceCandidates();
...@@ -105,7 +106,7 @@ export class MindsVideoComponent implements OnDestroy { ...@@ -105,7 +106,7 @@ export class MindsVideoComponent implements OnDestroy {
protected webtorrent: WebtorrentService, protected webtorrent: WebtorrentService,
protected cd: ChangeDetectorRef, protected cd: ChangeDetectorRef,
protected featuresService: FeaturesService, protected featuresService: FeaturesService,
private router: Router, private router: Router
) { } ) { }
ngOnInit() { ngOnInit() {
...@@ -397,27 +398,23 @@ export class MindsVideoComponent implements OnDestroy { ...@@ -397,27 +398,23 @@ export class MindsVideoComponent implements OnDestroy {
this.toggle(); this.toggle();
} }
requestMediaModal() { clickedVideo() {
if (!this.metadataLoaded) { if (!this.metadataLoaded) {
return; return;
} }
let isMediaPage = false; if (isMobile() && Math.min(screen.width, screen.height) < 768) {
if (!this.isModal && !this.isActivity) { this.isMobile = true;
isMediaPage = true;
}
if (this.isModal || (!isMediaPage && !this.featuresService.has('media-modal'))) {
this.toggle(); this.toggle();
return; return;
} }
// Mobile (not tablet) users go to media page instead of modal if (this.isActivity && this.featuresService.has('media-modal')){
if (isMobile() && !isMediaPage && Math.min(screen.width, screen.height) < 768) { this.mediaModalRequested.emit();
this.router.navigate([`/media/${this.guid}`]); return;
} }
this.mediaModalRequested.emit(); this.toggle();
} }
detectChanges() { detectChanges() {
...@@ -442,9 +439,10 @@ export class MindsVideoComponent implements OnDestroy { ...@@ -442,9 +439,10 @@ export class MindsVideoComponent implements OnDestroy {
} }
} }
toggleFullscreen() { toggleFullscreen($event) {
// This will only work on the main video on a media page (not comment attachments)
// TODO: make this work on pages with more than one m-video (i.e. feeds)
const elem = document.querySelector('m-video'); const elem = document.querySelector('m-video');
// this.fullscreenHovering = false;
// If fullscreen is not already enabled // If fullscreen is not already enabled
if ( !document['fullscreenElement'] && if ( !document['fullscreenElement'] &&
......
...@@ -42,7 +42,6 @@ import { MindsVideoComponent } from '../../components/video/video.component'; ...@@ -42,7 +42,6 @@ import { MindsVideoComponent } from '../../components/video/video.component';
[torrent]="[{ res: '720', key: object.guid + '/720.mp4' }, { res: '360', key: object.guid + '/360.mp4' }]" [torrent]="[{ res: '720', key: object.guid + '/720.mp4' }, { res: '360', key: object.guid + '/360.mp4' }]"
[log]="object.guid" [log]="object.guid"
[playCount]="false" [playCount]="false"
(click)="togglePlay($event)"
#player> #player>
<video-ads [player]="player" *ngIf="object.monetized"></video-ads> <video-ads [player]="player" *ngIf="object.monetized"></video-ads>
......