VR

public protocol VR : EventDispatcherProtocol

The player’s VR attributes can be used to change the stereo mode, the viewing direction and the vertical field of view.

Remark

The VR attributes are properties of the vr object, which is accessible through the player object.
  • A VR direction object with properties yaw, pitch and roll must be set to change the direction; the values of these properties should be in degrees.

    Remark

    When using native VR, if you set this property then the configured direction will be the new origin instead of 0,0,0.

    Declaration

    Swift

    var direction: VRDirection { get set }
  • Whether stereo VR mode is enabled.

    Remark

    Setting it to true renders the video in VR; setting it to false removes the VR rendering.

    Declaration

    Swift

    var stereo: Bool { get set }
  • Sets or returns the vertical field of view in VR. This value can be a degree in the range of [0, 180]. Increasing this value creates a more zoomed out effect.

    Declaration

    Swift

    var verticalFOV: Int { get set }
  • Adds the event listener of the given EventType.

    Remark

    When attaching a listener on the wrong object the application will crash.

    Declaration

    Swift

    func addEventListener<E>(type: EventType<E>, listener: @escaping (E) -> ()) -> EventListener where E : EventProtocol

    Parameters

    type

    EventType of the added event listener. See VREventTypes for possible values.

    listener

    Closure called when event is dispatched.

    Return Value

    The newly added EventListener.

  • Removes the event listener of the given EventType.

    Declaration

    Swift

    func removeEventListener<E>(type: EventType<E>, listener: EventListener) where E : EventProtocol

    Parameters

    type

    EventType of the event listener to be removed. See VREventTypes for possible values.

    listener

    EventListener which was added by addEventListener(...).