     func cancelOnEventTask() {
         guard let mTimer = _timer else {return}
         mTimer.invalidate()
+        _timer = nil
         isEventTimerTaskRunning = false
     }
     
-	func trackStart() {
-    
-	}
-    
     func trackPlayAndONEvent() {
-        
+        sendEvents(.play, .online)
     }
     
     func trackPauseEvent() {
-        
+        sendEvents(.pause)
     }
     
     func trackLoadEvent() {
-        
+        sendEvents(.load)
     }
     
     func trackOnEvent() {
-        
+        sendEvents(.online)
     }
     
-    func sendEvents(_ events: String...) {
+    func sendEvents(_ events: STTM2Event...) {
         
         var finalEvent: String?
         
         if events.count > 1 {
-            finalEvent = events.joined(separator: ",")
+            finalEvent = events.map{$0.rawValue}.joined(separator: ",")
         } else {
-            finalEvent = events[0]
+            finalEvent = events[0].rawValue
         }
         
         

import Foundation




//private static final String EVENT_LOAD = "lo";
//private static final String EVENT_PLAY = "pl";
//private static final String EVENT_PAUSE = "pa";
//private static final String EVENT_ONLINE = "on";
//private static final String EVENT_COMPLETE = "co";

class TrackingLive: NSObject, Tracking {


    func onLoadPlugin(with player: SambaPlayer) {
        self.player = player

        sttm2 = STTM2(player.media as! SambaMediaConfig)
        
        player.delegate = self
    }
    
    
    func onDestroyPlugin() {
        if sttm2 != nil {
            sttm2?.destroy()
            sttm2 = nil
        }
    }
    
}



class STTM2 {
    
    enum STTM2Event: String {
        case load = "lo"
        case play = "pl"
        case pause = "pa"
        case online = "on"
    }
    
	private var _media: SambaMediaConfig
	private var _timer: Timer?
