Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Documentation
Sidebar

SDLStreamingVideoScaleManager Class Reference

Section Contents

Overview

This class consolidates the logic of scaling between the view controller’s coordinate system and the display’s coordinate system.

The main goal of using scaling is to align different screens and use a common range of points per inch. This allows showing assets with a similar size on different screen resolutions.

scale

The scaling factor the app should use to change the size of the projecting view.

Objective-C

@property (assign, readwrite, nonatomic) float scale;

Swift

var scale: Float { get set }

displayViewportResolution

The screen resolution of the connected display. The units are pixels.

Objective-C

@property (assign, readwrite, nonatomic) CGSize displayViewportResolution;

Swift

var displayViewportResolution: CGSize { get set }

appViewportFrame

The frame of the app’s projecting view. This is calculated by dividing the display’s viewport resolution by the scale. The units are points.

Objective-C

@property (readonly, assign, nonatomic) CGRect appViewportFrame;

Swift

var appViewportFrame: CGRect { get }

-init

Creates a default streaming video scale manager. The scale value will be set to 1.0 and the displayViewportResolution will be set to {0, 0}.

Objective-C

- (nonnull instancetype)init;

Swift

init()

Return Value

A SDLStreamingVideoScaleManager object

-initWithScale:displayViewportResolution:

Convenience init for creating the manager with a scale and connected display viewport resolution.

Objective-C

- (nonnull instancetype)initWithScale:(float)scale
            displayViewportResolution:(CGSize)displayViewportResolution;

Swift

init(scale: Float, displayViewportResolution: CGSize)

Parameters

scale

The scaling factor the app should use to change the size of the projecting view

displayViewportResolution

The current screen resolution of the connected display

Return Value

A SDLStreamingVideoScaleManager object

-scaleTouchEventCoordinates:

Scales the coordinates of an OnTouchEvent from the display’s coordinate system to the app’s viewport coordinate system. If the scale value is less than 1.0, the touch events will be returned without being scaled.

Objective-C

- (nonnull SDLOnTouchEvent *)scaleTouchEventCoordinates:
    (nonnull SDLOnTouchEvent *)onTouchEvent;

Swift

func scaleTouchEventCoordinates(_ onTouchEvent: SDLOnTouchEvent) -> SDLOnTouchEvent

Parameters

onTouchEvent

A touch event with coordinates

Return Value

The touch event coordinates in the app’s viewport coordinate system

-scaleHapticRect:

Scales a haptic rectangle from the app’s viewport coordinate system to the display’s coordinate system. If the scale value is less than 1.0, the haptic rectangle will be returned without being scaled.

Objective-C

- (nonnull SDLHapticRect *)scaleHapticRect:(nonnull SDLHapticRect *)hapticRect;

Swift

func scale(_ hapticRect: SDLHapticRect) -> SDLHapticRect

Parameters

hapticRect

A haptic rectangle

Return Value

The position of the haptic rectangle in the display’s coordinate system

-stop

Stops the manager. This method is used internally.

Objective-C

- (void)stop;

Swift

func stop()
View on GitHub.com
Previous Section Next Section