# IMAStreamManager

    @interface IMAStreamManager : NSObject

The IMAStreamManager class is responsible for playing streams.
- `


  ### [delegate](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAStreamManager#/c:objc(cs)IMAStreamManager(py)delegate)


  ` The IMAStreamManagerDelegate to notify with events during stream playback.

  #### Declaration

  Swift

      weak var delegate: (any NSObjectProtocol & https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Protocols/IMAStreamManagerDelegate.html)? { get set }

  Objective-C

      @property (nonatomic, weak, nullable) NSObject<https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Protocols/IMAStreamManagerDelegate.html> *delegate;

- `


  ### [streamId](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAStreamManager#/c:objc(cs)IMAStreamManager(py)streamId)


  ` Identifier used during dynamic ad insertion to uniquely identify a stream. This can be used in
  the Stream Activity Monitor Debug Console to debug the stream session.

  #### Declaration

  Swift

      var streamId: String? { get }

  Objective-C

      @property (nonatomic, copy, readonly, nullable) NSString *streamId;

- `


  ### [cuepoints](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAStreamManager#/c:objc(cs)IMAStreamManager(py)cuepoints)


  ` The cuepoints for the current stream, populated after `kIMAAdEvent_CUEPOINTS_CHANGED` event is
  dispatched. Will be empty for live streams.

  #### Declaration

  Swift

      var cuepoints: [https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMACuepoint.html] { get }

  Objective-C

      @property (nonatomic, readonly) NSArray<https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMACuepoint.html *> *_Nonnull cuepoints;

- `


  ### [-initializeWithAdsRenderingSettings:](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAStreamManager#/c:objc(cs)IMAStreamManager(im)initializeWithAdsRenderingSettings:)


  ` Initializes and loads the stream.

  #### Declaration

  Swift

      func initialize(with adsRenderingSettings: https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAAdsRenderingSettings.html?)

  Objective-C

      - (void)initializeWithAdsRenderingSettings:
          (nullable https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAAdsRenderingSettings.html *)adsRenderingSettings;

  #### Parameters

  |---|---|
  | ` adsRenderingSettings ` | the IMAAdsRenderingSettings. Pass in to influence ad rendering. Use nil to default to standard rendering. |

- `


  ### [-streamTimeForContentTime:](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAStreamManager#/c:objc(cs)IMAStreamManager(im)streamTimeForContentTime:)


  ` Returns the stream time with ads for a given content time. Returns the given content time
  for live streams.

  #### Declaration

  Swift

      func streamTime(forContentTime contentTime: TimeInterval) -> TimeInterval

  Objective-C

      - (NSTimeInterval)streamTimeForContentTime:(NSTimeInterval)contentTime;

  #### Parameters

  |---|---|
  | ` contentTime ` | the content time without any ads (in seconds) |

  #### Return Value

  the stream time that corresponds with the given content time once ads are inserted
- `


  ### [-contentTimeForStreamTime:](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAStreamManager#/c:objc(cs)IMAStreamManager(im)contentTimeForStreamTime:)


  ` Returns the content time without ads for a given stream time. Returns the given stream time
  for live streams.

  #### Declaration

  Swift

      func contentTime(forStreamTime streamTime: TimeInterval) -> TimeInterval

  Objective-C

      - (NSTimeInterval)contentTimeForStreamTime:(NSTimeInterval)streamTime;

  #### Parameters

  |---|---|
  | ` streamTime ` | the stream time with inserted ads (in seconds) |

  #### Return Value

  the content time that corresponds with the given stream time once ads are removed
- `


  ### [-previousCuepointForStreamTime:](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAStreamManager#/c:objc(cs)IMAStreamManager(im)previousCuepointForStreamTime:)


  ` Returns the previous cuepoint for the given stream time. Returns nil if no such cuepoint exists.
  This is used to implement features like snap back, and called when the publisher detects that
  the user seeked in order to force the user to watch an ad break they may have skipped over.

  #### Declaration

  Swift

      func previousCuepoint(forStreamTime streamTime: TimeInterval) -> https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMACuepoint.html?

  Objective-C

      - (nullable https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMACuepoint.html *)previousCuepointForStreamTime:
          (NSTimeInterval)streamTime;

  #### Parameters

  |---|---|
  | ` streamTime ` | the stream time that the was seeked to. |

  #### Return Value

  the previous IMACuepoint for the given stream time.
- `


  ### [-replaceAdTagParameters:](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAStreamManager#/c:objc(cs)IMAStreamManager(im)replaceAdTagParameters:)


  ` Replaces all of the ad tag parameters used for upcoming ad requests for a
  live stream.
  Note that this call is a no-op for VOD streams.

  #### Declaration

  Swift

      func replaceAdTagParameters(_ adTagParameters: [String : String]?)

  Objective-C

      - (void)replaceAdTagParameters:
          (nullable NSDictionary<NSString *, NSString *> *)adTagParameters;

  #### Parameters

  |---|---|
  | ` adTagParameters ` | the new ad tag parameters for the current stream. |

- `


  ### [-loadThirdPartyStream:streamSubtitles:](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAStreamManager#/c:objc(cs)IMAStreamManager(im)loadThirdPartyStream:streamSubtitles:)


  ` Requests SDK to retrieve the ad metadata and then load the provided streamManifestUrl and
  streamSubtitles into the player. This should be manually triggered once the stream manifest has
  been retrieved from the third party video stitcher. Note that this is only used for Pod serving
  VOD with a third party video stitcher, and is a no-op for other stream request types.

  #### Declaration

  Swift

      func loadThirdPartyStream(_ streamURL: URL, streamSubtitles: [[String : String]])

  Objective-C

      - (void)loadThirdPartyStream:(nonnull NSURL *)streamURL
                   streamSubtitles:
                       (nonnull NSArray<NSDictionary<NSString *, NSString *> *> *)
                           streamSubtitles;

  #### Parameters

  |---|---|
  | ` streamURL ` | the manifest url for the stream with dynamic ad insertion. |
  | ` streamSubtitles ` | the subtitles array for the stream. |

- `


  ### [-destroy](https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/ios/reference/Classes/IMAStreamManager#/c:objc(cs)IMAStreamManager(im)destroy)


  ` Cleans the stream manager's internal state for proper deallocation.

  #### Declaration

  Swift

      func destroy()

  Objective-C

      - (void)destroy;