Version 2.9.0 modified the method signatures of some APIs, and completely deleted some expired APIs. If you upgrade from a lower version, you may find that some code does not work properly. This article will tell you how to migrate from the old version to 2.9.0.
2.8.0 and above, major changes have taken place in the
WhiteSdkConfiguration
class.
appIdentifier
parameter during initialization.zoomMinScale
and zoomMaxScale
properties to limit the field of view. Please call setCameraBound(CameraBound cameraBound)
of RoomParams``PlayerConfiguration
to limit. For details, please refer to the comments in the CameraBound
class.sdkStrategyConfig
property. This property has not been used since 2.8.0 and has no configuration meaning.debug
property is changed to the log
property, and the effect remains unchanged.hasUrlInterrupterAPI
, changed to enableInterrupterAPI
field, and corresponding setter``getter
changed to setEnableInterrupterAPI``isEnableInterrupterAPI
.disableDeviceInputs
configuration, you can set permissions before joining the room.View appIdentifier
Versions before 2.9.0, viewing angle restrictions, are all through the WhiteSdkConfiguration
zoomMaxScale
and zoomMinScale
properties to achieve.
Starting from 2.9.0, this attribute has been deleted. You can configure the cameraBound
attribute to replace it when joining a room and starting playback.
/**
* Field of view description
* @since 2.5.0
*/
public class CameraBound extends WhiteObject {
public Double getCenterX() {
return centerX;
}
/**
* The center point of the basic field of view, default 0
*
* @param centerX the center x
*/
public void setCenterX(Double centerX) {
this.centerX = centerX;
}
public Double getCenterY() {
return centerY;
}
/**
* The center point of the basic field of view, default 0
*
* @param centerY the center y
*/
public void setCenterY(Double centerY) {
this.centerY = centerY;
}
public Double getWidth() {
return width;
}
/**
* Basic field of view width, infinite if not passed
*
* Use with {@link #setMinContentMode(ContentModeConfig)} {@link #setMinContentMode(ContentModeConfig)},
* Used to describe the maximum and minimum zoom ratio.
*
* @param width the width
*/
public void setWidth(Double width) {
this.width = width;
}
public Double getHeight() {
return height;
}
/**
* Basic field of view height, if not passed, it will be infinite
*
* Use with {@link #setMinContentMode(ContentModeConfig)} {@link #setMinContentMode(ContentModeConfig)},
* Used to describe the maximum and minimum zoom ratio.
*
* @param height the height
*/
public void setHeight(Double height) {
this.height = height;
}
public ContentModeConfig getMaxContentMode() {
return maxContentMode;
}
/**
* The maximum zoom ratio, the maximum ratio will not be limited if it is not transmitted
*
* @param maxContentMode {@link ContentModeConfig}
*/
public void setMaxContentMode(ContentModeConfig maxContentMode) {
this.maxContentMode = maxContentMode;
}
public ContentModeConfig getMinContentMode() {
return minContentMode;
}
/**
* The minimum zoom ratio, the minimum ratio will not be restricted if it is not transmitted
*
* @param minContentMode {@link ContentModeConfig}
*/
public void setMinContentMode(ContentModeConfig minContentMode) {
this.minContentMode = minContentMode;
}
public Double getDamping() {
return damping;
}
/**
*
* Resistance parameters
*
* The resistance of hand gestures when crossing the boundary (range 0.0 ~ 1.0)
* When using multi-finger touch to change the viewing angle, if it crosses the boundary. The larger the value, the greater the resistance felt.
* When the value is 0.0, no resistance is felt at all; when the value is 1.0, it cannot be easily removed.
* Take the middle value, the feeling is somewhere in between.
* @param damping the damping
*/
public void setDamping(Double damping) {
this.damping = damping;
}
private Double damping;
private Double centerX;
private Double centerY;
private Double width;
private Double height;
private ContentModeConfig maxContentMode;
private ContentModeConfig minContentMode;
public CameraBound() {
super();
}
/**
* The effect is similar to zoomMinScale and zoomMaxScale deleted by sdkConfig
* @param miniScale
* @param maxScale
*/
public CameraBound(Double miniScale, Double maxScale) {
this();
ContentModeConfig miniConfig = new ContentModeConfig();
miniConfig.setScale(miniScale);
this.minContentMode = miniConfig;
ContentModeConfig maxConfig = new ContentModeConfig();
miniConfig.setScale(maxScale);
this.maxContentMode = maxConfig;
}
}
/**
* Field of view zoom description class
* @since 2.5.0
*/
public class ContentModeConfig extends WhiteObject {
public ContentModeConfig() {
scale = 1d;
space = 0d;
mode = ScaleMode.CENTER;
}
public enum ScaleMode {
/** Based on the zoom scale of the whiteboard zoomScale, the default processing */
@SerializedName("Scale")
CENTER,
/** Similar to {@link android.widget.ImageView.ScaleType#CENTER_INSIDE}, scaled proportionally to cover the set width and height range */
@SerializedName("AspectFit")
CENTER_INSIDE,
/** Similar to AspectFit. The width and height during processing, which is the reference width and height * scale */
@SerializedName("AspectFitScale")
CENTER_INSIDE_SCALE,
/** Similar to AspectFit. The width and height during processing is the reference width and height + space */
@SerializedName("AspectFitSpace")
CENTER_INSIDE_SPACE,
/** Similar to {@link android.widget.ImageView.ScaleType#CENTER_CROP}, scaled proportionally, the view content will be within the set width and height range */
@SerializedName("AspectFill")
CENTER_CROP,
/** Similar to AspectFill, the width and height during processing is the base width and height + space */
@SerializedName("AspectFillScale")
CENTER_CROP_SPACE,
}
public Double getScale() {
return scale;
}
/**
* Zoom ratio, default 1
*
* When the zoom mode {@link #getMode()} is {@link ScaleMode#CENTER} {@link ScaleMode#CENTER_INSIDE_SCALE}
* When {@link ScaleMode#CENTER_INSIDE_SCALE}, this attribute is valid.
*
* @param scale the scale
*/
public void setScale(Double scale) {
this.scale = scale;
}
public Double getSpace() {
return space;
}
/**
* The extra space on both sides relative to the reference field of view, default 0
*
* When the zoom mode {@link #getMode()} is {@link ScaleMode#CENTER_CROP_SPACE} {@link ScaleMode#CENTER_CROP_SPACE}
* When the attribute is valid.
*
* @param space the space
*/
public void setSpace(Double space) {
this.space = space;
}
public ScaleMode getMode() {
return mode;
}
/**
* Set the scale mode, default {@link ScaleMode#CENTER}
*
* @param mode the mode
*/
public void setMode(ScaleMode mode) {
this.mode = mode;
}
private Double scale;
private Double space;
private ScaleMode mode;
}
The CameraBound
function is more powerful than zoomMinScale
and zoomMaxScale
. You can read the above source code comments and configure, or you can directly use the provided CameraBound(Double miniScale, Double maxScale)
to achieve the effect.
/**
* The effect is similar to zoomMinScale and zoomMaxScale deleted by sdkConfig
* @param miniScale
* @param maxScale
*/
public CameraBound(Double miniScale, Double maxScale) {
this();
ContentModeConfig miniConfig = new ContentModeConfig();
miniConfig.setScale(miniScale);
this.minContentMode = miniConfig;
ContentModeConfig maxConfig = new ContentModeConfig();
miniConfig.setScale(maxScale);
this.maxContentMode = maxConfig;
}
In addition, you can also use the setCameraBound
method of room
and player
to modify the limit midway.
audioUrl
is changed to mediaURL
. The effect remains the same. This configuration can be used when the playback is only audio. If you want to display the video, you need to use the NativePlayer protocol provided by the native side. You can see the demo implementation for details.
Use the refreshViewSize
method uniformly.
Added the locked
field, the eraser and image erasing will be updated in the future. The current stage is a data upgrade.
PreFetcher
: Starting from 2.8.0, using smarter line selection, this class is no longer needed.Environment
: irrelevant classWhiteBroadView
: Change to WhiteboardView
.