File

src/app/modules/workspace/components/reviewsubmissions-contentplayer/reviewsubmissions-contentplayer.component.ts

Implements

OnInit

Metadata

Index

Properties
Methods

Constructor

constructor(resourceService: ResourceService, activatedRoute: ActivatedRoute, playerService: PlayerService, windowScrollService: WindowScrollService, toasterService: ToasterService, navigationHelperService: NavigationHelperService, configService: ConfigService, contentService: ContentService, routerNavigationService: RouterNavigationService)

Constructor to create injected service(s) object Default method of Draft Component class

Parameters :
Name Type Optional Description
resourceService ResourceService No

Reference of resourceService

activatedRoute ActivatedRoute No
playerService PlayerService No
windowScrollService WindowScrollService No
toasterService ToasterService No

Reference of ToasterService

navigationHelperService NavigationHelperService No
configService ConfigService No

Reference of configService

contentService ContentService No

Reference of contentService

routerNavigationService RouterNavigationService No

Methods

close
close()

closes conent player and revert to previous url

Returns : void
getContent
getContent()

used to fetch content details and player config. On success launches player.

Returns : void
ngOnInit
ngOnInit()
Returns : void
tryAgain
tryAgain()

retry launching player with same content details

Returns : void

Properties

Public activatedRoute
Type : ActivatedRoute
Public configService
Type : ConfigService

reference of ConfigService.

contentData
Type : ContentData

contain contentData

contentId
Type : string

content id

Public contentService
Type : ContentService

reference of ContentService.

errorMessage
Type : string

contain error message

loaderMessage
Type : ILoaderMessage

loader message

Public navigationHelperService
Type : NavigationHelperService
playerConfig
Type : PlayerConfig

contains player configuration

Public playerService
Type : PlayerService

To call PlayerService service

Public resourceService
Type : ResourceService

To call resource service which helps to use language constant

Public routerNavigationService
Type : RouterNavigationService

To navigate back to parent component

showError
Default value : false

Flag to show error

showLoader
Default value : true

To show / hide loader

Private toasterService
Type : ToasterService

To show toaster(error, success etc) after any API calls

Public windowScrollService
Type : WindowScrollService

To call PlayerService service

import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import {
  ResourceService, ILoaderMessage, PlayerConfig, ContentData,
  WindowScrollService, ToasterService, NavigationHelperService,
  ConfigService, RouterNavigationService
} from '@sunbird/shared';
import { PlayerService, ContentService } from '@sunbird/core';
@Component({
  selector: 'app-reviewsubmissions-contentplayer',
  templateUrl: './reviewsubmissions-contentplayer.component.html',
  styleUrls: ['./reviewsubmissions-contentplayer.component.scss']
})
export class ReviewsubmissionsContentplayerComponent implements OnInit {
  /**
   * loader message
  */
  loaderMessage: ILoaderMessage;

  /**
  * To show / hide loader
  */
  showLoader = true;
  /**
   * Flag to show error
   */
  showError = false;
  /**
   * content id
   */
  contentId: string;

  /**
  * contain error message
  */
  errorMessage: string;
  /**
  * To call resource service which helps to use language constant
  */
  public resourceService: ResourceService;

  /**
  * To call PlayerService service
  */
  public playerService: PlayerService;

  /**
  * To call PlayerService service
  */
  public windowScrollService: WindowScrollService;
  /**
   * contains player configuration
   */
  playerConfig: PlayerConfig;

  /**
   * contain contentData
  */
  contentData: ContentData;
  /**
  * To show toaster(error, success etc) after any API calls
  */
  private toasterService: ToasterService;
  /**
   * reference of ConfigService.
  */
  public configService: ConfigService;
  /**
   * reference of ContentService.
   */
  public contentService: ContentService;

  /**
   * To navigate back to parent component
   */
  public routerNavigationService: RouterNavigationService;
  /**
  * Constructor to create injected service(s) object
  Default method of Draft Component class
  * @param {ResourceService} resourceService Reference of resourceService
  * @param {ToasterService} toasterService Reference of ToasterService
  * @param {ContentService} contentService Reference of contentService
  * @param {configService} configService Reference of configService
  */
  constructor(resourceService: ResourceService, public activatedRoute: ActivatedRoute,
    playerService: PlayerService, windowScrollService: WindowScrollService,
    toasterService: ToasterService, public navigationHelperService: NavigationHelperService,
    configService: ConfigService, contentService: ContentService,
    routerNavigationService: RouterNavigationService) {
    this.resourceService = resourceService;
    this.playerService = playerService;
    this.windowScrollService = windowScrollService;
    this.toasterService = toasterService;
    this.configService = configService;
    this.contentService = contentService;
    this.routerNavigationService = routerNavigationService;
    this.loaderMessage = {
      'loaderMessage': this.resourceService.messages.stmsg.m0025,
    };
  }

  ngOnInit() {
    this.activatedRoute.params.subscribe((params) => {
      this.contentId = params.contentId;
      this.getContent();
    });
  }
  /**
   * used to fetch content details and player config. On success launches player.
   */
  getContent() {
    this.showLoader = true;
    const option = {
      params: { mode: 'edit' }
    };
    this.playerService.getContent(this.contentId, option).subscribe(
      (response) => {
        const contentDetails = {
          contentId: this.contentId,
          contentData: response.result.content
        };
        this.playerConfig = this.playerService.getConfig(contentDetails);
        this.contentData = response.result.content;
        this.showLoader = false;
      },
      (err) => {
        this.showError = true;
        this.errorMessage = this.resourceService.messages.stmsg.m0009;
        this.toasterService.error(this.resourceService.messages.fmsg.m0015);
      });
  }
  /**
   * retry launching player with same content details
   * @memberof ContentPlayerComponent
   */
  tryAgain() {
    this.showError = false;
    this.getContent();
  }
  /**
  * closes conent player and revert to previous url
  * @memberof ContentPlayerComponent
  */
  close() {
    this.navigationHelperService.navigateToPreviousUrl('/workspace/content/flagged/1');
  }
}


<div class="ui grid">
  <div class="one wide column"></div>
  <div class="ten wide column uzindex">
    <div class="row" *ngIf="showLoader">
      <app-loader [data]="loaderMessage"></app-loader>
    </div>

    <div class="row mt-10" *ngIf="!showLoader && contentData">

      <div class="videosegment  ui clearing segment">
        <div class="ten wide column">
          <span class="ui HomeAccordianHeading left floated header">
          {{contentData.name}}
          </span>
        </div>
        <div class="two wide column">
          <h5 class="ui right floated basic icon circular button  mouse-pointer" tabindex="0" (click)="close()">
            <i class="ui remove icon" tabindex="0" (click)="close()"></i>
          </h5>
        </div>
      </div>
      <div class="aspectratio sbt-shadow-radius" data-ratio="16:9" #aspectRatio>
      <app-player class="content-player" [playerConfig]="playerConfig"></app-player>
    </div>
    </div>
    <div class="ui grid" *ngIf="!showLoader && contentData">
      <div class="eight wide column">
        <app-content-player-metadata [contentData]="contentData"></app-content-player-metadata>
      </div>
      <div class="four wide column">
      </div>
    </div>

    <div *ngIf="showError">
      <div class="ui active dimmer inverted">
        <div class="content">
          <div class="center">
            <h2 class="ui header red">
              {{errorMessage}}
            </h2>
            <span>
            <button class="ui button" tabindex="0" (click)="tryAgain()">{{resourceService.frmelmnts.btn.tryagain}}</button>
            </span>
            <span>
              <button class="ui red button" tabindex="0" (click)="close()">{{resourceService.frmelmnts.btn.close}}</button>
            </span>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

./reviewsubmissions-contentplayer.component.scss

@use "@project-sunbird/sb-styles/assets/mixins/mixins"as *;
@use 'pages/player-fullScreen'as *;
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""