src/app/modules/public/module/help/components/offline-help-videos/offline-help-videos.component.ts
OnInit
OnDestroy
AfterViewInit
selector | app-offline-help-videos |
styleUrls | ./offline-help-videos.component.scss |
templateUrl | ./offline-help-videos.component.html |
Properties |
Methods |
Outputs |
constructor(document: Document, resourceService: ResourceService, configService: ConfigService, activatedRoute: ActivatedRoute, cdr: ChangeDetectorRef)
|
||||||||||||||||||
Parameters :
|
closeVideoModal | |
Type : EventEmitter
|
|
changeVideoAttributes | ||||||
changeVideoAttributes(data: any)
|
||||||
Parameters :
Returns :
void
|
closeModal |
closeModal()
|
Returns :
void
|
interpolateInstance | ||||
interpolateInstance(message)
|
||||
Parameters :
Returns :
any
|
ngAfterViewInit |
ngAfterViewInit()
|
Returns :
void
|
ngOnDestroy |
ngOnDestroy()
|
Returns :
void
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
setInteractData | ||||
setInteractData(data)
|
||||
Parameters :
Returns :
{ id: any; type: string; pageid: any; }
|
setVideoHeight |
setVideoHeight()
|
Returns :
void
|
Public activatedRoute |
Type : ActivatedRoute
|
activeVideoObject |
aspectRatio |
Type : ElementRef
|
Decorators :
@ViewChild('aspectRatio')
|
aspectRatioHeight |
Type : number
|
Public configService |
Type : ConfigService
|
instance |
Type : string
|
playerInfo |
Type : ElementRef
|
Decorators :
@ViewChild('playerInfo')
|
playerInfoHeight |
Type : number
|
Public resourceService |
Type : ResourceService
|
selectVideoInteractEdata |
Type : IInteractEventEdata
|
slideConfig |
Type : object
|
slideData |
Type : object
|
Public unsubscribe$ |
Default value : new Subject<void>()
|
videoContainerHeight |
Type : number
|
import { ActivatedRoute } from '@angular/router';
import { ResourceService, ConfigService } from '@sunbird/shared';
import { Component, OnInit, Output, EventEmitter, ViewChild, Inject, OnDestroy, ElementRef, ChangeDetectorRef, AfterViewInit } from '@angular/core';
import { IInteractEventEdata } from '@sunbird/telemetry';
import { DOCUMENT } from '@angular/common';
import $ from 'jquery';
import * as _ from 'lodash-es';
import { takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
@Component({
selector: 'app-offline-help-videos',
templateUrl: './offline-help-videos.component.html',
styleUrls: ['./offline-help-videos.component.scss']
})
export class OfflineHelpVideosComponent implements OnInit, OnDestroy, AfterViewInit {
@Output() closeVideoModal = new EventEmitter<any>();
@ViewChild('aspectRatio') aspectRatio: ElementRef;
@ViewChild('playerInfo') playerInfo: ElementRef;
videoContainerHeight: number;
aspectRatioHeight: number;
playerInfoHeight: number;
public unsubscribe$ = new Subject<void>();
slideConfig: object;
slideData: object;
activeVideoObject;
instance: string;
selectVideoInteractEdata: IInteractEventEdata;
constructor(@Inject(DOCUMENT) private document: Document, public resourceService: ResourceService, public configService: ConfigService,
public activatedRoute: ActivatedRoute, private cdr: ChangeDetectorRef ) {
this.instance = (<HTMLInputElement>document.getElementById('instance'))
? (<HTMLInputElement>document.getElementById('instance')).value : 'sunbird';
}
ngOnInit() {
this.slideConfig = this.configService.offlineConfig.watchVideo;
this.resourceService.languageSelected$.pipe(takeUntil(this.unsubscribe$)).subscribe(item => {
this.slideData = [
{
id: 'add-content-offline',
name: this.interpolateInstance(this.resourceService.frmelmnts.instn.t0095),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_download_content_from_DIKSHA_Library.mp4'
},
{
id: 'add-content-online',
name: this.interpolateInstance(this.resourceService.frmelmnts.instn.t0094),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_load_content_to_the_desktop_app.mp4'
},
{
id: 'copy-content',
name: this.interpolateInstance(this.resourceService.frmelmnts.instn.t0097),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_copy_content_to_my_pen_drive.mp4'
},
{
id: 'find-content-offline',
name: this.interpolateInstance(this.resourceService.frmelmnts.instn.t0096),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_play_content.mp4'
},
{
id: 'add-content-online-joyful-theme',
name: this.interpolateInstance(this.resourceService.frmelmnts.vidttl.loadcontent),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_load_content_to_the_desktop_app_joyful_theme.mp4'
},
{
id: 'add-content-offline-joyful-theme',
name: this.interpolateInstance(this.resourceService.frmelmnts.vidttl.downloadcontent),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_download_content_from_DIKSHA_Library_joyful_theme.mp4'
},
{
id: 'find-content-offline-joyful-theme',
name: this.interpolateInstance(this.resourceService.frmelmnts.vidttl.playcontent),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_play_content_joyful_theme.mp4'
},
{
id: 'copy-content-joyful-theme',
name: this.interpolateInstance(this.resourceService.frmelmnts.vidttl.copycontent),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_copy_content_to_my_pen_drive_joyful_theme.mp4'
},
{
id: 'how-to-login',
name: this.interpolateInstance(this.resourceService.frmelmnts.vidttl.login),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_login_on_diksha.mp4'
},
{
id: 'recover-account',
name: this.interpolateInstance(this.resourceService.frmelmnts.vidttl.recovaccnt),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_recover_myaccount.mp4'
},
{
id: 'register-on-diksha',
name: this.interpolateInstance(this.resourceService.frmelmnts.vidttl.register),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_register_on_diksha.mp4'
},
{
id: 'how-to-login-joyful-theme',
name: this.interpolateInstance(this.resourceService.frmelmnts.vidttl.loginnewtheme),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_login_on_diksha_joyful_theme.mp4'
},
{
id: 'recover-account-joyful-theme',
name: this.interpolateInstance(this.resourceService.frmelmnts.vidttl.recovaccntnewtheme),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_recover_myaccount_joyful_theme.mp4'
},
{
id: 'register-on-diksha-joyful-theme',
name: this.interpolateInstance(this.resourceService.frmelmnts.vidttl.registernewtheme),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_register_on_diksha_joyful_theme.mp4'
},
{
id: 'add-managed-user',
name: this.interpolateInstance(this.resourceService.frmelmnts.vidttl.manageuser),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_add_users_on_DIKSHA.mp4'
},
{
id: 'add-managed-user-joyful-theme',
name: this.interpolateInstance(this.resourceService.frmelmnts.vidttl.manageusernewtheme),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_add_users_on_DIKSHA_joyful_theme.mp4'
},
{
id: 'login-with-sso-joyful-theme',
name: this.interpolateInstance(this.resourceService.frmelmnts.vidttl.SSologinnewtheme),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_login_using_my_State_ID_joyful_theme.mp4'
},
{
id: 'login-with-sso',
name: this.interpolateInstance(this.resourceService.frmelmnts.vidttl.loginSSO),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_login_using_my_State_ID.mp4'
},
{
id: 'login-with-google-joyful-theme',
name: this.interpolateInstance(this.resourceService.frmelmnts.vidttl.newthemegooglelogin),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_login_using_my_Google_ID_joyful_theme.mp4'
},
{
id: 'login-with-google',
name: this.interpolateInstance(this.resourceService.frmelmnts.vidttl.googlelogin),
thumbnail: 'assets/images/play-icon.svg',
url: 'assets/videos/How_do_I_login_using_my_Google_ID.mp4'
}
];
this.activeVideoObject = this.slideData[0];
});
}
ngAfterViewInit() {
this.setVideoHeight();
this.cdr.detectChanges();
}
setVideoHeight() {
console.log('aspect ratio value', this.aspectRatio);
this.aspectRatioHeight = this.aspectRatio.nativeElement.offsetHeight;
this.playerInfoHeight = this.playerInfo.nativeElement.offsetHeight;
this.videoContainerHeight = this.aspectRatioHeight + this.playerInfoHeight;
}
interpolateInstance(message) {
return message.replace('{instance}', _.upperCase(this.instance));
}
changeVideoAttributes(data: any) {
this.activeVideoObject = data;
$('#video').attr('src', data.url);
}
closeModal() {
this.closeVideoModal.emit('success');
}
setInteractData(data) {
return {
id: data.id,
type: 'click',
pageid: _.get(this.activatedRoute.snapshot.data.telemetry, 'pageid') || 'help'
};
}
ngOnDestroy() {
this.unsubscribe$.next();
this.unsubscribe$.complete();
}
}
<div class="sb-g content-video">
<div class="sb-g-col-xs-12 sb-g-col-md-8 sb-g-col-xl-9 content-video__player" id="player-area-height">
<!-- video placeholder -->
<div class="aspectratio" data-ratio="16:9" id="content-video-aspect-ratio" #aspectRatio>
<div>
<video id="video" autoplay width="560" height="349" controls class="sb-offline-video-player"
src="{{activeVideoObject.url}}">
</video>
</div>
</div>
<!-- video meta data holder -->
<div class="d-flex flex-w-wrap content-video__player__details" #playerInfo>
<h6 class="content-video__player__title ml-8 mr-auto sb__ellipsis sb__ellipsis--two">
{{activeVideoObject.name}}‎</h6>
<!-- <div class="d-flex flex-w-wrap content-video__player__tools">
<button class="sb-btn sb-btn-link sb-btn-link-primary sb-btn-sm sb-btn-square"><i
class="icon download alternate"></i><span>Download</span></button>
</div> -->
</div>
</div>
<div class="sb-g-col-xs-12 sb-g-col-md-4 sb-g-col-xl-3 content-video__content" [style.height.px]="videoContainerHeight">
<!-- card component -->
<div *ngFor="let video of slideData" class="sbcard sbcard--recently-viewed mb-8"
[ngClass]="{active:activeVideoObject.id === video.id }" tabindex="0" (click)="changeVideoAttributes(video)"
appTelemetryInteract [telemetryInteractEdata]="setInteractData(video)">
<div class="sbcard__main-area">
<!-- card img -->
<div class="sbcard__img">
<div class="img-container">
<!-- <img src="./assets/images/book.png" alt=""> -->
<img class="thumbnail" src="{{video.thumbnail}}" alt="">
</div>
</div>
<!-- card mobile view details -->
<div class="sbcard__info text-left">
<h4 class="sbcard__title sb__ellipsis sb__ellipsis--two" title="{{ video.name }}">{{ video.name }}‎</h4>
<div class="d-block sb-color-primary fs-0-785">{{resourceService?.frmelmnts?.lbl?.playVideo}}</div>
</div>
</div>
</div>
</div>
</div>
./offline-help-videos.component.scss
@use "@project-sunbird/sb-styles/assets/mixins/mixins" as *;
@use "components/video" as *;
// sb card css
.sbcard {
width: 100%;
border-radius: 0px;
background-color: var(--white);
display: flex;
flex-direction: column;
cursor: pointer;
position: relative;
border-bottom: calculateRem(1px) solid var(--gray-0);
box-shadow: 0 calculateRem(3px) calculateRem(5px) 0 rgba(var(--rc-rgba-black), 0.12);
contain: content;
&.active {
background: var(--primary-100);
}
@include respond-above(sm) {
border-radius: calculateRem(2px);
box-shadow: 0 calculateRem(2px) calculateRem(7px) 0 rgba(var(--rc-rgba-black), 0.16);
border-bottom: 0px solid var(--gray-0);
}
&__main-area {
display: flex;
flex-direction: row;
align-items: center;
height: 5.5rem;
// border-bottom: calculateRem(1px) solid var(--gray-0);
}
&__img {
height: calculateRem(72px);
width: calculateRem(72px);
overflow: hidden;
flex: 0 0 calculateRem(72px);
padding: calculateRem(8px);
.img-container {
display: flex;
align-items: center;
background-color: var(--gray-100);
height: 4.5rem;
width: 4.5rem;
img {
width: 100%;
backdrop-filter: brightness(93%) opacity(85%) blur(3px) contrast(110%);
}
}
}
&__title {
color: var(--gray-800);
font-size: var(--font-size-base);
margin: 0px;
line-height: normal;
line-height: calculateRem(20px);
word-break: break-word;
}
&__meta1 {
color: var(--gray-300);
font-size: var(--font-size-sm);
display: inline-flex;
align-items: center;
line-height: calculateRem(20px);
}
&--recently-viewed {
.sbcard__img {
width: calculateRem(88px);
height: calculateRem(88px);
flex: 0 0 calculateRem(88px);
.img-container {
display: flex;
align-items: center;
background-color: var(--gray-100);
margin: calculateRem(-8px);
height: 5.5rem;
width: 5.5rem;
}
}
.sbcard__info {
padding: calculateRem(8px);
}
}
&:last-child {
margin-bottom: 0px !important;
}
&:hover h4.sbcard__title {
color: var(--primary-400);
}
}