 package com.kaltura.kdpfl.view.media
 {
+	import com.kaltura.commands.stats.StatsReportError;
 	import com.kaltura.kdpfl.controller.media.LiveStreamCommand;
 	import com.kaltura.kdpfl.model.ConfigProxy;
 	import com.kaltura.kdpfl.model.MediaProxy;

	import org.osmf.events.TimeEvent;
	import org.osmf.media.MediaPlayer;
	import org.osmf.media.MediaPlayerState;
	import org.osmf.traits.DynamicStreamTrait;
	import org.osmf.traits.MediaTraitType;
	import org.osmf.traits.TimeTrait;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;
	
	/**
	 * Mediator for the KMediaPlayer component 

						sendNotification(NotificationType.DO_PLAY);
					}
					break;
				
				case NotificationType.MEDIA_ERROR:
					if (!_mediaErrorSent)
					{
						//notify the server - for troubleshooting
						var data:MediaErrorEvent = note.getBody().errorEvent as MediaErrorEvent;
						var message:String =
							"pid: " + _flashvars.partnerId + 
							"| uiconfId: " + _flashvars.uiConfId + 
							"| referrer: " + _flashvars.referrer +
							"| resourceUrl: " + _mediaProxy.vo.resource["url"] +
							"| Flavor index : " + player.currentDynamicStreamIndex +
							"| Error ID: "+ data.error.errorID +
							"| Error Message: "+ data.error.message +  
							"| Stack Trace: " + data.error.getStackTrace();
						//if error occured before first play, send also the initial bitrate index
						if (!_hasPlayed)
						{
							message += "| Initial flavor index: " + _mediaProxy.startingIndex;
						}
						
						var sendError:StatsReportError = new StatsReportError(NotificationType.MEDIA_ERROR, message);
						sendError.method = URLRequestMethod.POST;
						
						(facade.retrieveProxy(ServicesProxy.NAME) as ServicesProxy).vo.kalturaClient.post(sendError);
						_mediaErrorSent = true;
					}
				
					break;
			}
		}
		
