Skip to content

Commit

Permalink
Merge pull request #247 from DolbyIO/release/3.10.0-beta.3
Browse files Browse the repository at this point in the history
Release/3.10.0 beta.3
  • Loading branch information
graduad committed Aug 10, 2023
2 parents 294541c + 26e6e4f commit 606187c
Show file tree
Hide file tree
Showing 49 changed files with 580 additions and 200 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ dependencies {
implementation "androidx.appcompat:appcompat:1.1.0"
implementation "androidx.annotation:annotation:1.1.0"

implementation "io.dolby:sdk:3.10.+"
implementation "io.dolby:sdk:[3.10.1,3.11)"

testImplementation("junit:junit:${JUNIT_VERSION}")
testImplementation("org.powermock:powermock-api-mockito2:${POWERMOCK_VERSION}")
Expand Down
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ MOCKITO_CORE_VERSION=2.26.0
POWERMOCK_VERSION=2.0.2
ROBOLECTRIC_VERSION=4.4
JUNIT_VERSION=4.13.2
COMMS_SDK_VERSION="3.10.0-beta.2"
COMMS_SDK_VERSION="3.10.0-beta.3"
COMPONENT_NAME="react-native-sdk"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.dolby.sdk.comms.reactnative.eventemitters

import com.facebook.react.bridge.Arguments
import com.facebook.react.bridge.ReactApplicationContext
import com.voxeet.android.media.capture.audio.preview.RecorderStatus
import com.voxeet.android.media.capture.audio.preview.AudioPreviewStatus
import com.voxeet.sdk.services.AudioService

/**
Expand All @@ -19,7 +19,7 @@ class RNAudioPreviewEventEmitter (
/**
* Emitted when the application user received an audio preview status changed.
*/
private val previewCallback: (RecorderStatus) -> Unit = { status ->
private val previewCallback: (AudioPreviewStatus) -> Unit = { status ->
if (isRegister) {
Arguments.createMap()
.apply {
Expand All @@ -33,12 +33,12 @@ class RNAudioPreviewEventEmitter (

override fun registerNativeEventBus() {
isRegister = true
audioService.local.preview().callback = previewCallback
audioService.local.preview().onStatusChanged = previewCallback
}

override fun unregisterNativeEventBus() {
isRegister = false
audioService.local.preview().callback = null
audioService.local.preview().onStatusChanged = null
}

private object NotificationEvent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,12 @@ class RNConferenceServiceModule(
*/
@ReactMethod
fun current(promise: ReactPromise) {
Promises.promise(conferenceService.conference) { "Missing current conference" }
val conference = conferenceService.conference
if (conference == null || !conferenceService.isInConference) {
promise.resolve(null);
return
}
Promises.promise(conference) { "Couldn't get current conference" }
.thenValue(conferenceMapper::toRN)
.forward(promise)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ class RNAudioPreviewModule(
}

/**
* Cancels recording or playing an audio sample.
* @param promise return Boolean
* Stops recording or playing an audio sample.
* @param promise returns null
*/
@ReactMethod
fun cancel(promise: ReactPromise) {
Promises.promise({ localAudio.preview().cancel() })
.forward(promise)
fun stop(promise: ReactPromise) {
Promises.promise({ localAudio.preview().stop() })
.forward(promise, ignoreReturnType = true)
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
package io.dolby.sdk.comms.reactnative.view

import android.content.Context
import android.widget.FrameLayout
import com.facebook.react.bridge.ReactMethod
import com.facebook.react.bridge.ReadableArray
import com.facebook.react.bridge.ReadableMap
import com.facebook.react.uimanager.ReactStylesDiffMap
import com.facebook.react.uimanager.SimpleViewManager
import com.facebook.react.uimanager.StateWrapper
import com.facebook.react.uimanager.ThemedReactContext
import com.facebook.react.uimanager.annotations.ReactProp
import com.facebook.yoga.YogaMeasureMode
import com.voxeet.android.media.MediaStream
import com.voxeet.sdk.services.ConferenceService
import com.voxeet.sdk.views.VideoView
import io.dolby.sdk.comms.reactnative.eventemitters.RNVideoViewEventEmitter

/**
Expand All @@ -18,11 +23,11 @@ import io.dolby.sdk.comms.reactnative.eventemitters.RNVideoViewEventEmitter
class VideoViewManager(
private val eventEmitter: RNVideoViewEventEmitter,
private val conferenceService: ConferenceService
) : SimpleViewManager<VideoView>() {
) : SimpleViewManager<VideoViewWrapper>() {

override fun getName() = VIDEO_VIEW_NAME

override fun createViewInstance(reactContext: ThemedReactContext) = VideoView(reactContext)
override fun createViewInstance(reactContext: ThemedReactContext) = VideoViewWrapper(reactContext)

/**
* Exposes available commands to RN
Expand All @@ -34,7 +39,7 @@ class VideoViewManager(
* Receives RN command specified in [getCommandsMap]
* Sends back result in form of a event using [RNVideoViewEventEmitter]
*/
override fun receiveCommand(videoView: VideoView, commandId: String?, args: ReadableArray?) {
override fun receiveCommand(videoView: VideoViewWrapper, commandId: String?, args: ReadableArray?) {
super.receiveCommand(videoView, commandId, args)
val requestId = args?.getInt(REQUEST_ID_ARG) ?: return

Expand Down Expand Up @@ -72,27 +77,31 @@ class VideoViewManager(
* @param mirror boolean telling if video image should be flipped horizontally
*/
@ReactProp(name = "isMirror")
fun setMirror(videoView: VideoView, mirror: Boolean) = videoView.setMirror(mirror)
fun setMirror(videoView: VideoViewWrapper, mirror: Boolean) = videoView.setMirror(mirror)

/**
* Allows changing video scaling type.
* @param videoView view on which property has been set
* @param scaleType String with "fill" or "fit" value
*/
@ReactProp(name = "scaleType")
fun setScaleType(videoView: VideoView, scaleType: String): Unit = when (scaleType) {
SCALE_TYPE_FILL -> videoView.setVideoFill()
else -> videoView.setVideoFit()
fun setScaleType(videoView: VideoViewWrapper, scaleType: String): Unit {
when (scaleType) {
SCALE_TYPE_FILL -> {
videoView.setVideoFill()
}
else -> videoView.setVideoFit()
}
}

private fun detach(videoView: VideoView) = try {
private fun detach(videoView: VideoViewWrapper) = try {
videoView.unAttach()
true
} catch (exception: Exception) {
false
}

private fun attach(participantId: String?, streamId: String?, videoView: VideoView): Boolean {
private fun attach(participantId: String?, streamId: String?, videoView: VideoViewWrapper): Boolean {
return try {
if (participantId == null || streamId == null) return false
findMediaStream(participantId, streamId)?.let {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package io.dolby.sdk.comms.reactnative.view

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.FrameLayout
import com.voxeet.android.media.MediaStream
import com.voxeet.sdk.views.VideoView

import io.dolby.sdk.comms.reactnative.R


class VideoViewWrapper(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : FrameLayout(context, attrs, defStyleAttr) {

constructor(context: Context) : this(context, null)
constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)

val isAttached: Boolean
get() = videoView?.isAttached ?: false

private val videoView: VideoView?

init {
val root = LayoutInflater.from(context).inflate(R.layout.video_wrapper, this, true)
videoView = root.findViewById(R.id.video_view)
}

fun attach(participantId: String, stream: MediaStream) {
videoView?.attach(participantId, stream)
requestLayout()
}

fun unAttach() {
videoView?.unAttach()
requestLayout()
}

fun setVideoFill() {
videoView?.setVideoFill()
}

fun setVideoFit() {
videoView?.setVideoFit()
}

fun setMirror(mirror: Boolean) {
videoView?.isMirror = mirror
}

override fun requestLayout() {
super.requestLayout()
post {
measure(
MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
)
layout(left, top, right, bottom)
}
}
}
13 changes: 13 additions & 0 deletions android/src/main/res/layout/video_wrapper.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
>
<com.voxeet.sdk.views.VideoView
android:id="@+id/video_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
</FrameLayout>
14 changes: 7 additions & 7 deletions docs/classes/internal.AudioPreview.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The AudioPreview model allows the local participant to test different capture mo
- [setCaptureMode](internal.AudioPreview.md#setcapturemode)
- [play](internal.AudioPreview.md#play)
- [record](internal.AudioPreview.md#record)
- [cancel](internal.AudioPreview.md#cancel)
- [stop](internal.AudioPreview.md#stop)
- [release](internal.AudioPreview.md#release)
- [onStatusChanged](internal.AudioPreview.md#onstatuschanged)

Expand All @@ -31,13 +31,13 @@ The AudioPreview model allows the local participant to test different capture mo

### status

**status**(): `Promise`<[`RecorderStatus`](../enums/internal.RecorderStatus.md)\>
**status**(): `Promise`<[`AudioPreviewStatus`](../enums/internal.AudioPreviewStatus.md)\>

Gets the recording status.

#### Returns

`Promise`<[`RecorderStatus`](../enums/internal.RecorderStatus.md)\>
`Promise`<[`AudioPreviewStatus`](../enums/internal.AudioPreviewStatus.md)\>

___

Expand Down Expand Up @@ -107,15 +107,15 @@ Starts recording an audio sample if no recording is in progress.

___

### cancel
### stop

**cancel**(): `Promise`<`boolean`\>
**stop**(): `Promise`<`void`\>

Cancels recording or playing an audio sample.
Stops recording or playing an audio sample.

#### Returns

`Promise`<`boolean`\>
`Promise`<`void`\>

___

Expand Down
4 changes: 2 additions & 2 deletions docs/classes/internal.ConferenceService.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ ___

### current

**current**(): `Promise`<[`Conference`](../interfaces/internal.Conference.md)\>
**current**(): `Promise`<``null`` \| [`Conference`](../interfaces/internal.Conference.md)\>

Returns the Conference object for the current conference.

#### Returns

`Promise`<[`Conference`](../interfaces/internal.Conference.md)\>
`Promise`<``null`` \| [`Conference`](../interfaces/internal.Conference.md)\>

___

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Enumeration: RecorderStatus
# Enumeration: AudioPreviewStatus

[internal](../modules/internal.md).RecorderStatus
[internal](../modules/internal.md).AudioPreviewStatus

The RecorderStatus model gathers all possible statuses of audio samples recording for audio preview.
The AudioPreviewStatus model gathers all possible statuses of audio samples recording for audio preview.

This model is available in SDK 3.10 and later.

## Table of contents

### Enumeration Members

- [NoRecordingAvailable](internal.RecorderStatus.md#norecordingavailable)
- [RecordingAvailable](internal.RecorderStatus.md#recordingavailable)
- [Recording](internal.RecorderStatus.md#recording)
- [Playing](internal.RecorderStatus.md#playing)
- [Released](internal.RecorderStatus.md#released)
- [NoRecordingAvailable](internal.AudioPreviewStatus.md#norecordingavailable)
- [RecordingAvailable](internal.AudioPreviewStatus.md#recordingavailable)
- [Recording](internal.AudioPreviewStatus.md#recording)
- [Playing](internal.AudioPreviewStatus.md#playing)
- [Released](internal.AudioPreviewStatus.md#released)

## Enumeration Members

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ The model is supported in SDK 3.10 and later.

### status

**status**: [`RecorderStatus`](../enums/internal.RecorderStatus.md)
**status**: [`AudioPreviewStatus`](../enums/internal.AudioPreviewStatus.md)

The recording status.
2 changes: 1 addition & 1 deletion docs/modules/internal.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
- [AudioCaptureMode](../enums/internal.AudioCaptureMode.md)
- [NoiseReductionLevel](../enums/internal.NoiseReductionLevel.md)
- [VoiceFont](../enums/internal.VoiceFont.md)
- [RecorderStatus](../enums/internal.RecorderStatus.md)
- [AudioPreviewStatus](../enums/internal.AudioPreviewStatus.md)
- [ConferenceStatus](../enums/internal.ConferenceStatus.md)
- [ParticipantStatus](../enums/internal.ParticipantStatus.md)
- [ParticipantType](../enums/internal.ParticipantType.md)
Expand Down
10 changes: 5 additions & 5 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ PODS:
- glog
- react-native-comms-sdk (3.10.0-beta.2):
- React-Core
- VoxeetSDK (~> 3.10.0)
- VoxeetSDK (~> 3.10.1)
- react-native-document-picker (7.1.3):
- React-Core
- react-native-safe-area-context (3.4.1):
Expand Down Expand Up @@ -458,7 +458,7 @@ PODS:
- ReactCommon/turbomodule/core
- Yoga
- SocketRocket (0.6.0)
- VoxeetSDK (3.10.0)
- VoxeetSDK (3.10.1)
- Yoga (1.14.0)
- YogaKit (1.18.1):
- Yoga (~> 1.14)
Expand Down Expand Up @@ -676,7 +676,7 @@ SPEC CHECKSUMS:
React-jsiexecutor: 515b703d23ffadeac7687bc2d12fb08b90f0aaa1
React-jsinspector: 9f7c9137605e72ca0343db4cea88006cb94856dd
React-logger: 957e5dc96d9dbffc6e0f15e0ee4d2b42829ff207
react-native-comms-sdk: c27f79d0582d6b39dbc20c24e7de52128b0f54b9
react-native-comms-sdk: dfe0d3a3eabd670de4c0dbf47282409a6d5fe91f
react-native-document-picker: ec07866a30707f23660c0f3ae591d669d3e89096
react-native-safe-area-context: 9e40fb181dac02619414ba1294d6c2a807056ab9
React-perflogger: af8a3d31546077f42d729b949925cc4549f14def
Expand All @@ -697,10 +697,10 @@ SPEC CHECKSUMS:
RNPermissions: 314155ed6ce65237e7bd9fb6239219cce83228d3
RNReanimated: cc5e3aa479cb9170bcccf8204291a6950a3be128
SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608
VoxeetSDK: 57ff7e1325fb8e36fcbfe96e2cf2fd7a36a9eb9e
VoxeetSDK: bc2f2566624c2ad13dfb0fa4498020e7c15e85fa
Yoga: 5ed1699acbba8863755998a4245daa200ff3817b
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: 20a3e54e5b6e278732f5d890081ed875e8df52ce

COCOAPODS: 1.12.1
COCOAPODS: 1.11.3
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-native-comms-sdk-example",
"description": "Example app for react-native-dolbyio-sdk",
"version": "3.10.0-beta.2+1",
"version": "3.10.0-beta.3+1",
"license": "MIT",
"private": true,
"scripts": {
Expand Down

0 comments on commit 606187c

Please sign in to comment.