UNPKG

@firebolt-js/sdk

Version:
204 lines (161 loc) 4.15 kB
/* * Copyright 2021 Comcast Cable Communications Management, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0 */ import Transport from '../Transport/index.mjs' function ready() { return Transport.send('metrics', 'ready', {}) } function signIn() { return Transport.send('metrics', 'signIn', {}) } function signOut() { return Transport.send('metrics', 'signOut', {}) } // Methods function action(category, type, parameters) { const transforms = null return Transport.send( 'Metrics', 'action', { category, type, parameters }, transforms, ) } function appInfo(build) { const transforms = null return Transport.send('Metrics', 'appInfo', { build }, transforms) } function error(type, code, description, visible, parameters) { const transforms = null return Transport.send( 'Metrics', 'error', { type, code, description, visible, parameters }, transforms, ) } function mediaEnded(entityId) { const transforms = null return Transport.send('Metrics', 'mediaEnded', { entityId }, transforms) } function mediaLoadStart(entityId) { const transforms = null return Transport.send('Metrics', 'mediaLoadStart', { entityId }, transforms) } function mediaPause(entityId) { const transforms = null return Transport.send('Metrics', 'mediaPause', { entityId }, transforms) } function mediaPlay(entityId) { const transforms = null return Transport.send('Metrics', 'mediaPlay', { entityId }, transforms) } function mediaPlaying(entityId) { const transforms = null return Transport.send('Metrics', 'mediaPlaying', { entityId }, transforms) } function mediaProgress(entityId, progress) { const transforms = null return Transport.send( 'Metrics', 'mediaProgress', { entityId, progress }, transforms, ) } function mediaRateChange(entityId, rate) { const transforms = null return Transport.send( 'Metrics', 'mediaRateChange', { entityId, rate }, transforms, ) } function mediaRenditionChange(entityId, bitrate, width, height, profile) { const transforms = null return Transport.send( 'Metrics', 'mediaRenditionChange', { entityId, bitrate, width, height, profile }, transforms, ) } function mediaSeeked(entityId, position) { const transforms = null return Transport.send( 'Metrics', 'mediaSeeked', { entityId, position }, transforms, ) } function mediaSeeking(entityId, target) { const transforms = null return Transport.send( 'Metrics', 'mediaSeeking', { entityId, target }, transforms, ) } function mediaWaiting(entityId) { const transforms = null return Transport.send('Metrics', 'mediaWaiting', { entityId }, transforms) } function page(pageId) { const transforms = null return Transport.send('Metrics', 'page', { pageId }, transforms) } function startContent(entityId) { const transforms = null return Transport.send('Metrics', 'startContent', { entityId }, transforms) } function stopContent(entityId) { const transforms = null return Transport.send('Metrics', 'stopContent', { entityId }, transforms) } export default { /** * */ ErrorType: { NETWORK: 'network', MEDIA: 'media', RESTRICTION: 'restriction', ENTITLEMENT: 'entitlement', OTHER: 'other', }, action, appInfo, error, mediaEnded, mediaLoadStart, mediaPause, mediaPlay, mediaPlaying, mediaProgress, mediaRateChange, mediaRenditionChange, mediaSeeked, mediaSeeking, mediaWaiting, page, startContent, stopContent, } export { ready, signIn, signOut }