jsbindings/jsbindings.cpp
/**
 * @brief Adds a JS function as listener for a particular event
 *
 * @param[in] jsObj       Instance of AAMP_JS
 * @param[in] type        Event type
 * @param[in] jsCallback  Callback to be registered as listener
 */
@brief Adds a JS function as listener for a particular event
@param[in] jsObj       Instance of AAMP_JS
@param[in] type        Event type
@param[in] jsCallback  Callback to be registered as listener
@brief Adds a JS function as listener for a particular event @param [ in ] jsObj Instance of AAMP_JS @param [ in ] type Event type @param [ in ] jsCallback Callback to be registered as listener
void AAMP_JSListener::AddEventListener(AAMP_JS* aamp, AAMPEventType type, JSObjectRef jsCallback)
{
	LOG("[AAMP_JS] %s(%p, %d, %p)", __FUNCTION__, aamp, type, jsCallback);
	AAMP_JSListener* pListener = 0;
	if(type == AAMP_EVENT_PROGRESS)
	{
		pListener = new AAMP_JSListener_Progress(aamp, type, jsCallback);
	}
	else if(type == AAMP_EVENT_SPEED_CHANGED)
	{
		pListener = new AAMP_JSListener_SpeedChanged(aamp, type, jsCallback);
	}
	else if(type == AAMP_EVENT_CC_HANDLE_RECEIVED)
	{
		pListener = new AAMP_JSListener_CCHandleReceived(aamp, type, jsCallback);
	}
	else if(type == AAMP_EVENT_MEDIA_METADATA)
	{
		pListener = new AAMP_JSListener_VideoMetadata(aamp, type, jsCallback);
	}
	else if(type == AAMP_EVENT_TUNE_FAILED)
	{
		pListener = new AAMP_JSListener_TuneFailed(aamp, type, jsCallback);
	}
	else if(type == AAMP_EVENT_BITRATE_CHANGED)
	{
		pListener = new AAMP_JSListener_BitRateChanged(aamp, type, jsCallback);
	}
	else if(type == AAMP_EVENT_TIMED_METADATA)
	{
		pListener = new AAMP_JSListener_TimedMetadata(aamp, type, jsCallback);
	}
	else if(type == AAMP_EVENT_STATE_CHANGED)
	{
		pListener = new AAMP_JSListener_StatusChanged(aamp, type, jsCallback);
	}
	else if(type == AAMP_EVENT_SPEEDS_CHANGED)
	{
		pListener = new AAMP_JSListener_SpeedsChanged(aamp, type, jsCallback);
	}
	else if (type == AAMP_EVENT_REPORT_ANOMALY)
	{
		pListener = new AAMP_JSListener_AnomalyReport(aamp, type, jsCallback);
	}
	else if (type == AAMP_EVENT_DRM_METADATA)
	{
		pListener = new AAMP_JSListener_DRMMetadata(aamp, type, jsCallback);
	}
	else
	{
		pListener = new AAMP_JSListener(aamp, type, jsCallback);
	}
	pListener->_pNext = aamp->_listeners;
	aamp->_listeners = pListener;
	aamp->_aamp->AddEventListener(type, pListener);
}
void AAMP_JSListener :: AddEventListener ( AAMP_JS * aamp , AAMPEventType type , JSObjectRef jsCallback ) { LOG ( " " , __FUNCTION__ , aamp , type , jsCallback ) ; AAMP_JSListener * pListener = 0 ; if ( type == AAMP_EVENT_PROGRESS ) { pListener = new AAMP_JSListener_Progress ( aamp , type , jsCallback ) ; } else if ( type == AAMP_EVENT_SPEED_CHANGED ) { pListener = new AAMP_JSListener_SpeedChanged ( aamp , type , jsCallback ) ; } else if ( type == AAMP_EVENT_CC_HANDLE_RECEIVED ) { pListener = new AAMP_JSListener_CCHandleReceived ( aamp , type , jsCallback ) ; } else if ( type == AAMP_EVENT_MEDIA_METADATA ) { pListener = new AAMP_JSListener_VideoMetadata ( aamp , type , jsCallback ) ; } else if ( type == AAMP_EVENT_TUNE_FAILED ) { pListener = new AAMP_JSListener_TuneFailed ( aamp , type , jsCallback ) ; } else if ( type == AAMP_EVENT_BITRATE_CHANGED ) { pListener = new AAMP_JSListener_BitRateChanged ( aamp , type , jsCallback ) ; } else if ( type == AAMP_EVENT_TIMED_METADATA ) { pListener = new AAMP_JSListener_TimedMetadata ( aamp , type , jsCallback ) ; } else if ( type == AAMP_EVENT_STATE_CHANGED ) { pListener = new AAMP_JSListener_StatusChanged ( aamp , type , jsCallback ) ; } else if ( type == AAMP_EVENT_SPEEDS_CHANGED ) { pListener = new AAMP_JSListener_SpeedsChanged ( aamp , type , jsCallback ) ; } else if ( type == AAMP_EVENT_REPORT_ANOMALY ) { pListener = new AAMP_JSListener_AnomalyReport ( aamp , type , jsCallback ) ; } else if ( type == AAMP_EVENT_DRM_METADATA ) { pListener = new AAMP_JSListener_DRMMetadata ( aamp , type , jsCallback ) ; } else { pListener = new AAMP_JSListener ( aamp , type , jsCallback ) ; } pListener -> _pNext = aamp -> _listeners ; aamp -> _listeners = pListener ; aamp -> _aamp -> AddEventListener ( type , pListener ) ; }
@brief Adds a JS function as listener for a particular event
 @param[in] jsObj       Instance of AAMP_JS
 @param[in] type        Event type
 @param[in] jsCallback  Callback to be registered as listener
@brief Adds a JS function as listener for a particular event @param [ in ] jsObj Instance of AAMP_JS @param [ in ] type Event type @param [ in ] jsCallback Callback to be registered as listener