jsbindings/jscontroller-jsbindings.cpp
/**
 * @brief Callback invoked from JS to set the CC enabled property
 *
 * @param[in] context JS exception context
 * @param[in] thisObject JSObject on which to set the property's value
 * @param[in] propertyName JSString containing the name of the property to set
 * @param[in] value JSValue to use as the property's value
 * @param[out] exception pointer to a JSValueRef in which to return an exception, if any
 *
 * @retval true if the property was set, otherwise false
 */


@retval true if the property was set, otherwise false
@retval true if the property was set otherwise false
static bool AAMPJSC_setProperty_closedCaptionEnabled(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
{
	LOG("[AAMP_JSController] %s()\n", __FUNCTION__);
	AAMP_JSController* obj = (AAMP_JSController*) JSObjectGetPrivate(thisObject);
	if (obj == NULL)
	{
		*exception = aamp_GetException(context, AAMPJS_MISSING_OBJECT, "Can only call AAMP_JSController.closedCaptionEnabled on instances of AAMP_JSController");
		return false;
	}
	else if (!JSValueIsBoolean(context, value))
	{
		*exception = aamp_GetException(context, AAMPJS_INVALID_ARGUMENT, "Failed to execute 'AAMP_JSController.closedCaptionEnabled' - value passed is not boolean");
		return false;
	}
#ifdef AAMP_CC_ENABLED
	bool status = JSValueToBoolean (context, value);
	aamp_setClosedCaptionStatus(obj, status);
#else
	*exception = aamp_GetException(context, AAMPJS_GENERIC_ERROR, "CC is not configured in aamp!");
	return false;
#endif
	return true;
}
static bool AAMPJSC_setProperty_closedCaptionEnabled ( JSContextRef context , JSObjectRef thisObject , JSStringRef propertyName , JSValueRef value , JSValueRef * exception ) { LOG ( " \n " , __FUNCTION__ ) ; AAMP_JSController * obj = ( AAMP_JSController * ) JSObjectGetPrivate ( thisObject ) ; if ( obj == NULL ) { * exception = aamp_GetException ( context , AAMPJS_MISSING_OBJECT , " " ) ; return false ; } else if ( ! JSValueIsBoolean ( context , value ) ) { * exception = aamp_GetException ( context , AAMPJS_INVALID_ARGUMENT , " " ) ; return false ; } #ifdef AAMP_CC_ENABLED bool status = JSValueToBoolean ( context , value ) ; aamp_setClosedCaptionStatus ( obj , status ) ; #else * exception = aamp_GetException ( context , AAMPJS_GENERIC_ERROR , " " ) ; return false ; #endif return true ; }
@brief Callback invoked from JS to set the CC enabled property
 @param[in] context JS exception context
 @param[in] thisObject JSObject on which to set the property's value
 @param[in] propertyName JSString containing the name of the property to set
 @param[in] value JSValue to use as the property's value
 @param[out] exception pointer to a JSValueRef in which to return an exception, if any
@brief Callback invoked from JS to set the CC enabled property @param [ in ] context JS exception context @param [ in ] thisObject JSObject on which to set the property ' s value @param [ in ] propertyName JSString containing the name of the property to set @param [ in ] value JSValue to use as the property ' s value @param [ out ] exception pointer to a JSValueRef in which to return an exception if any