RDK Documentation (Open Sourced RDK Components)
jsutils.cpp File Reference

JavaScript util functions for AAMP. More...

#include "jsutils.h"
#include <stdlib.h>
#include <stdio.h>
#include <cmath>
#include <iomanip>
#include <algorithm>
Include dependency graph for jsutils.cpp:

Go to the source code of this file.

Data Structures

struct  EventTypeMap
 Struct to map names of AAMP events and JS events. More...
 

Macros

#define MAX_DEBUG_LOG_BUFF_SIZE   1024
 

Functions

JSValueRef aamp_CStringToJSValue (JSContextRef context, const char *sz)
 Convert C string to JSString.
 
char * aamp_JSValueToCString (JSContextRef context, JSValueRef value, JSValueRef *exception)
 Convert JSString to C string.
 
char * aamp_JSValueToJSONCString (JSContextRef context, JSValueRef value, JSValueRef *exception)
 Convert JSString to JSON C string.
 
bool aamp_JSValueIsArray (JSContextRef context, JSValueRef value)
 Check if a JSValue object is array or not.
 
std::vector< std::string > aamp_StringArrayToCStringArray (JSContextRef context, JSValueRef arrayRef)
 Convert an array of JSString to an array of C strings.
 
JSValueRef aamp_GetException (JSContextRef context, ErrorCode error, const char *additionalInfo)
 Generate a JSValue object with the exception details.
 
AAMPEventType aamp_getEventTypeFromName (const char *szName)
 Convert JS event name to AAMP event type.
 
void aamp_dispatchEventToJS (JSContextRef context, JSObjectRef callback, JSObjectRef event)
 To dispatch a JS event.
 
AAMPEventType aampPlayer_getEventTypeFromName (const char *szName)
 Convert JS event name to AAMP event type (AAMPMediaPlayer)
 
const char * aampPlayer_getNameFromEventType (AAMPEventType type)
 Convert AAMP event type to JS event string (AAMPMediaPlayer)
 
JSObjectRef aamp_CreateTimedMetadataJSObject (JSContextRef context, long long timeMS, const char *szName, const char *szContent, const char *id, double durationMS)
 Create a TimedMetadata JS object with args passed. Sample input "#EXT-X-CUE:ID=eae90713-db8e,DURATION=30.063" Sample output {"time":62062,"duration":0,"name":"#EXT-X-CUE","content":"-X-CUE:ID=eae90713-db8e,DURATION=30.063","type":0,"metadata":{"ID":"eae90713-db8e","DURATION":"30.063"},"id":"eae90713-db8e"}.
 
void jsBindingLogprintf (int playerId, const char *levelstr, const char *functionName, int line, const char *format,...)
 Print logs to console / log file.
 

Variables

static EventTypeMap aamp_eventTypes []
 Map AAMP events to its corresponding JS event strings (used by JSPP)
 
static EventTypeMap aampPlayer_eventTypes []
 Map AAMP events to its corresponding JS event strings (used by AAMPMediaPlayer/UVE APIs)
 

yes

JavaScript util functions for AAMP.

Definition in file jsutils.cpp.


Data Structure Documentation

◆ EventTypeMap

struct EventTypeMap

Struct to map names of AAMP events and JS events.

Definition at line 47 of file jsutils.cpp.

Collaboration diagram for EventTypeMap:
Collaboration graph
Data Fields
AAMPEventType eventType
const char * szName