|
RDK Documentation (Open Sourced RDK Components)
|
Go to the documentation of this file.
24 #ifndef __AAMP_JSUTILS_H__
25 #define __AAMP_JSUTILS_H__
28 #include "AampUtils.h"
30 #include <JavaScriptCore/JavaScript.h>
36 #define PLAYER_ID_NA -5
39 #define LOG_INFO(AAMP_JS_OBJECT,FORMAT, ...) if(AAMP_JS_OBJECT && AAMP_JS_OBJECT->bInfoEnabled) { jsBindingLogprintf(( (NULL != AAMP_JS_OBJECT)? AAMP_JS_OBJECT->iPlayerId : PLAYER_ID_NA ),"INFO",__FUNCTION__,__LINE__,FORMAT, ##__VA_ARGS__); }
40 #define LOG_ERROR(AAMP_JS_OBJECT,FORMAT, ...) jsBindingLogprintf(( (NULL != AAMP_JS_OBJECT)?AAMP_JS_OBJECT->iPlayerId : PLAYER_ID_NA ),"ERR",__FUNCTION__,__LINE__,FORMAT, ##__VA_ARGS__)
41 #define LOG_WARN(AAMP_JS_OBJECT,FORMAT, ...) jsBindingLogprintf(((NULL != AAMP_JS_OBJECT)?AAMP_JS_OBJECT->iPlayerId : PLAYER_ID_NA ),"WARN",__FUNCTION__,__LINE__,FORMAT, ##__VA_ARGS__)
44 #define LOG_WARN_EX(FORMAT, ...) jsBindingLogprintf(PLAYER_ID_NA,"WARN",__FUNCTION__,__LINE__,FORMAT, ##__VA_ARGS__)
45 #define LOG_ERROR_EX(FORMAT, ...) jsBindingLogprintf(PLAYER_ID_NA,"ERR",__FUNCTION__,__LINE__,FORMAT, ##__VA_ARGS__)
48 #define LOG_TRACE(FORMAT, ...) jsBindingLogprintf(PLAYER_ID_NA,"TRACE",__FUNCTION__,__LINE__,FORMAT, ##__VA_ARGS__)
51 #define LOG_TRACE(FORMAT, ...)
54 #define EXCEPTION_ERR_MSG_MAX_LEN 1024
56 #ifndef MUTE_SUBTITLES_TRACKID
57 #define MUTE_SUBTITLES_TRACKID (-1)
67 AAMPJS_INVALID_ARGUMENT = -1,
68 AAMPJS_MISSING_OBJECT = -2,
69 AAMPJS_GENERIC_ERROR = -3
162 JSObjectRef
aamp_CreateTimedMetadataJSObject(JSContextRef context,
long long timeMS,
const char* szName,
const char* szContent,
const char*
id,
double durationMS);
165 void jsBindingLogprintf(
int playerId,
const char* levelstr,
const char* functionName,
int line,
const char *format, ...);
Types and APIs exposed by the AAMP player.
const char * aampPlayer_getNameFromEventType(AAMPEventType type)
Convert AAMP event type to JS event string (AAMPMediaPlayer)
JSValueRef aamp_GetException(JSContextRef context, ErrorCode error, const char *additionalInfo)
Generate a JSValue object with the exception details.
JSValueRef aamp_CStringToJSValue(JSContextRef context, const char *sz)
Convert C string to JSString.
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,...
ErrorCode
JavaScript error codes.
char * aamp_JSValueToCString(JSContextRef context, JSValueRef value, JSValueRef *exception)
Convert JSString to C string.
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.
char * aamp_JSValueToJSONCString(JSContextRef context, JSValueRef value, JSValueRef *exception)
Convert JSString to JSON C string.
std::vector< std::string > aamp_StringArrayToCStringArray(JSContextRef context, JSValueRef arrayRef)
Convert an array of JSString to an array of C strings.
AAMPEventType aampPlayer_getEventTypeFromName(const char *szName)
Convert JS event name to AAMP event type (AAMPMediaPlayer)
AAMPEventType
Type of the events sending to the JSPP player.
void jsBindingLogprintf(int playerId, const char *levelstr, const char *functionName, int line, const char *format,...)
Print logs to console / log file.
bool aamp_JSValueIsArray(JSContextRef context, JSValueRef value)
Check if a JSValue object is array or not.