         if options?.object(forKey: "direction") != nil {
             let direction = options!.object(forKey: "direction") as! String
 
-            if direction == "inactive" {
-                rtcRtpTransceiverInit.direction = RTCRtpTransceiverDirection.inactive
-            } else if direction == "recvonly" {
-                rtcRtpTransceiverInit.direction = RTCRtpTransceiverDirection.recvOnly
-            } else if direction == "rendonly" {
-                rtcRtpTransceiverInit.direction = RTCRtpTransceiverDirection.sendOnly
-            } else if direction == "sendrecv" {
-                rtcRtpTransceiverInit.direction = RTCRtpTransceiverDirection.sendRecv
-            } else if direction == "stopped" {
-                rtcRtpTransceiverInit.direction = RTCRtpTransceiverDirection.stopped
-            }
+            rtcRtpTransceiverInit.direction = PluginRTCRtpTransceiver.stringToDirection(direction: direction)
         }
 
         if options?.object(forKey: "streams") != nil {

                "stopped": self.rtcRtpTransceiver!.isStopped
            ]
        ])
    }
    
    static func directionToString(direction: RTCRtpTransceiverDirection) -> String {

    }
    
    func setDirection(direction: String) {
        self.rtcRtpTransceiver!.direction = PluginRTCRtpTransceiver.stringToDirection(direction: direction)
        
        self.eventListener!([
            "type": "state",
