---
title: "removeTimeObserver(_:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avplayer/removetimeobserver(_:)"
---

# removeTimeObserver(_:)

Cancels a previously registered periodic or boundary time observer.

## Declaration

```swift
nonisolated func removeTimeObserver(_ observer: Any)
```

## Parameters

- `observer`: An object returned by a previous call to doc://com.apple.avfoundation/documentation/AVFoundation/AVPlayer/addPeriodicTimeObserver(forInterval:queue:using:) or doc://com.apple.avfoundation/documentation/AVFoundation/AVPlayer/addBoundaryTimeObserver(forTimes:queue:using:).

## Mentioned in

Monitoring playback progress in your app

## Discussion

Discussion Upon return, the caller is guaranteed that no new time observer blocks will begin executing. Depending on the calling thread and the queue used to add the time observer, an in-flight block may continue to execute after this method returns. You can guarantee synchronous time observer removal by enqueuing the call to removeTimeObserver on that queue. Alternatively, call dispatch_sync(queue, ^{}) after removeTimeObserver to wait for any in-flight blocks to finish executing. You should use this method to explicitly cancel each time observer added using addPeriodicTimeObserver(forInterval:queue:using:) and addBoundaryTimeObserver(forTimes:queue:using:). The following shows a common implementation to remove a registered time observer:

## See Also

### Observing playback time

- [currentTime()](avfoundation/avplayer/currenttime().md)
- [addPeriodicTimeObserver(forInterval:queue:using:)](avfoundation/avplayer/addperiodictimeobserver(forinterval:queue:using:).md)
- [addBoundaryTimeObserver(forTimes:queue:using:)](avfoundation/avplayer/addboundarytimeobserver(fortimes:queue:using:).md)
