File

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

Metadata

selector app-reviewsubmissions-contentplayer
templateUrl reviewsubmissions-contentplayer.component.html

Constructor

constructor(resourceService: any, activatedRoute: ActivatedRoute, playerService: any, windowScrollService: any, toasterService: any, navigationHelperService: any, configService: any, contentService: any, routerNavigationService: any)

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

Parameters :
  • resourceService : ResourceService

    Reference of resourceService

  • toasterService : ToasterService

    Reference of ToasterService

  • contentService : ContentService

    Reference of contentService

  • configService : configService

    Reference of configService

Methods

getContent
getContent()

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

Returns: void
tryAgain
tryAgain()

retry launching player with same content details

Returns: void
close
close()

closes conent player and revert to previous url

Returns: void

Properties

activatedRoute
activatedRoute: ActivatedRoute
Public configService
configService: any

reference of ConfigService.

contentData
contentData: any

contain contentData

contentId
contentId: string

content id

Public contentService
contentService: any

reference of ContentService.

errorMessage
errorMessage: string

contain error message

loaderMessage
loaderMessage: any

loader message

navigationHelperService
navigationHelperService: any
playerConfig
playerConfig: any

contains player configuration

Public playerService
playerService: any

To call PlayerService service

Public resourceService
resourceService: any

To call resource service which helps to use language constant

Public routerNavigationService
routerNavigationService: any

To navigate back to parent component

showError
showError: boolean
Default value: false

Flag to show error

showLoader
showLoader: boolean
Default value: true

To show / hide loader

Private toasterService
toasterService: any

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

Public windowScrollService
windowScrollService: any

To call PlayerService service

import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } 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'
})
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');
  }
}

results matching ""

    No results matching ""