目录

1. Overview

Interface info
public interface com.huawei.hms.panorama.PanoramaInterface.PanoramaLocalInterface

API for panorama display in an app.

2. Public Method Summary

Return
Method
int

init()

Initializes an API in an app.

View

getView()

Obtains the view for displaying a panorama.

int

setImage(Uri uri, int type)

Sets a panorama and a format.

Surface

getSurface(int type)

Obtains the surface used for video display.

int

setValue(String name, String value)

Sets attributes.

String

getValue(String name)

Obtains attribute values.

void

setControlMode(int mode)

Sets the mode for controlling a panorama when it is viewed.

void

updateTouchEvent(MotionEvent event)

Updates a touch event, which is valid only in touch mode.

void

deInit()

Deinitializes the API in the app and destroys the resources.

3. Public Methods

3.1 init

Method

int init();

Initializes an API in an app.

Return

Type
Description

int

If the operation is successful, value ResultCode.SUCCESS is returned. Otherwise, an error code is returned.

3.2 getView

Method

View getView()

Obtains the view for displaying a panorama. You can add the view to your own layout based on the actual requirements.

Return

Type
Description

View

View for rendering a panorama.

3.3 setImage

Method

int setImage(Uri uri, int type)

Sets a panorama and a format.

Parameters

Parameter
Description

uri

URI of the panorama to be loaded.

Three URIs starting with file, content, and android.resourceare supported.

type

Panorama type.

Currently, spherical(IMAGE_TYPE_SPHERICAL) and cylindrical(IMAGE_TYPE_RING) panoramas are supported.

Return

Type
Description

int

If the operation is successful, value ResultCode.SUCCESS is returned. Otherwise, an error code is returned.

3.4 getSurface

Method

Surface getSurface(int type);

Obtains the surface used for video display.

Parameters

ParameterDescription
type

Type of images decoded from video.

Return

TypeDescription
Surface

Surface that displays video images decoded by the video player.

3.5 setValue

Method

int setValue(String name, String value)

Sets attributes.

Parameter

ParameterDescription

name

Name of the attribute to be set.

value

Value of the attribute to be set

Return

TypeDescription

int

If the API is called successfully, ResultCode.SUCCEED is returned. Otherwise, an error code is returned.

3.6 getValue

Method

String getValue(String name)

Obtains attribute values.

Parameter

ParameterDescription

name

Name of the attribute whose value is to be obtained.

Return

TypeDescription

String

If the API is called successfully, the attribute value is returned. 

If the API fails to be called or the attribute value cannot be obtained, an empty string is returned.

Note:

Names of attribute names that can be obtained in this version.

ParameterDescription

KEY_RENDER_MODE

Rendering mode.

KEY_CURRENT_AZIMUTH

Current azimuth.

KEY_CURRENT_HORIZONTAL_FOV

Current horizontal FOV.

3.7 setControlMode

Method

void setControlMode(int mode)

Sets the mode for controlling a panorama when it is viewed,which can be dynamically changed.

Parameter

Parameter
Description

mode

Sets the mode for controlling a panorama when it is viewed.

Currently, motion tracking control and touch mode are supported.

You need to call updateTouchEvent for the touch mode.

3.8 updateTouchEvent

Method

void updateTouchEvent(MotionEvent event)

Updates a touch event, which is valid only in touch mode.

Parameter

ParameterDescription

event

Standard touch event of Android. The touch position is calculated by using the upper left corner of the panorama view control as the origin (0,0).

The event can be passed through OnTouchListener of the view.

You can process the touch event required by an upper-layer app and transfer other events tothe SDK for processing.

3.9 deInit

Method

void deInit()

Deinitializes the API in the app and destroys the resources.

Return

Type
Description

int

If the operation is successful, value ResultCode.SUCCEED is returned. Otherwise, an error code is returned.