File

src/app/modules/shared/services/offline-card-service/offline-card.service.ts

Index

Methods

Methods

isYoutubeContent
isYoutubeContent(content)
Parameters :
Name Optional
content No
Returns : boolean
import { Injectable } from '@angular/core';
import * as _ from 'lodash-es';

@Injectable({
  providedIn: 'root'
})
export class OfflineCardService {

  isYoutubeContent(content) {
    let mimeTypesCountObj;
    const contentData = _.isEmpty(_.get(content, 'metaData')) ? content : content.metaData;
    try { mimeTypesCountObj = JSON.parse(content.mimeTypesCount); } catch (error) { mimeTypesCountObj = undefined; }
    if (_.includes(['video/youtube', 'video/x-youtube'], contentData.mimeType)
      || _.has(mimeTypesCountObj, 'video/youtube') || _.has(mimeTypesCountObj, 'video/x-youtube')) {
      return true;
    }
      return false;
  }
}

results matching ""

    No results matching ""