 		NotificationCenter.default.removeObserver(self)
 		_isFullscreen = false
 		_player = nil
+        
+        // Cast
+        if let mCastPlayer = castPlayer {
+            mCastPlayer.destroy()
+        }
+        
+        SambaCast.sharedInstance.unSubscribe(delegate: self)
         castPlayer = nil
         castPlayerController = nil
         

			detachVC(player, nil, false)
		}
        
        if let mCastPlayer = castPlayer {
            castPlayer?.destroy()
        }
        
        if let mCastPlayerController = castPlayerController {
            detachVC(mCastPlayerController, nil, false)
        }

                SambaCast.sharedInstance.unSubscribe(delegate: self)
            }
        }
    }
    
    
    private func getCastCaptionFormat() -> String? {
        guard let mCaptionScreen = _captionsScreen as? CaptionsScreen,
        mCaptionScreen.hasCaptions,
        let mCaptions = media.captions, mCaptions.count > 0 else {
            return nil
        }
        
        let currentCaptionIndex = mCaptionScreen.currentIndex
        
        let currentCaption = mCaptions[currentCaptionIndex]
        
        return String(format: "[%s,ffcc00,42]", currentCaption.language)
    }
    
    
