Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #353 from DolbyIO/release/3.8.2-beta.2
Browse files Browse the repository at this point in the history
Release/3.8.2 beta.2
  • Loading branch information
graduad authored May 12, 2023
2 parents 5a2b370 + 5633c83 commit b24ee6b
Show file tree
Hide file tree
Showing 14 changed files with 101 additions and 28 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 3.8.2-beta.2

### Features

Added a new [ScaleType](https://api-references.dolby.io/comms-sdk-flutter/dolbyio_comms_sdk_flutter/ScaleType.html) argument to the [VideoView](https://api-references.dolby.io/comms-sdk-flutter/dolbyio_comms_sdk_flutter/VideoView-class.html) creation methods. The argument lets you select how you want to display a video stream in the VideoView area. You can either use the `fill` or `fit` value.

## 3.8.2-beta.1

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
COMMS_SDK_VERSION="3.8.2-beta.1"
COMMS_SDK_VERSION="3.8.2-beta.2"
COMPONENT_NAME="flutter-sdk"
14 changes: 11 additions & 3 deletions android/src/main/kotlin/io/dolby/comms/sdk/flutter/NativeView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ package io.dolby.comms.sdk.flutter

import com.voxeet.sdk.views.VideoView
import android.content.Context
import android.view.View
import com.voxeet.VoxeetSDK
import io.dolby.comms.sdk.flutter.mapper.MediaStreamMapper
import io.dolby.comms.sdk.flutter.mapper.ParticipantMapper
import io.flutter.plugin.common.BinaryMessenger
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
Expand Down Expand Up @@ -49,6 +46,7 @@ class NativeView(context: Context, id: Int, messenger: BinaryMessenger): Platfor

val participantId = arguments?.get("participant_id") as String?
val mediaStreamLabel = arguments?.get("media_stream_label") as String?
val scaleType = arguments?.get("scale_type") as String?

if (participantId != null && mediaStreamLabel != null) {
VoxeetSDK.conference()
Expand All @@ -60,6 +58,8 @@ class NativeView(context: Context, id: Int, messenger: BinaryMessenger): Platfor
videoView.unAttach()
}

setScaleType(scaleType)

result.success(null)

} ?: result.error("INVALID_ARGUMENTS", "Invalid arguments for attach method: $arguments", null)
Expand All @@ -70,6 +70,14 @@ class NativeView(context: Context, id: Int, messenger: BinaryMessenger): Platfor
result.success(null)
}

fun setScaleType(scaleType: String?) {
when (scaleType) {
"SCALE_TYPE_FIT" -> videoView.setVideoFit()
"SCALE_TYPE_FILL" -> videoView.setVideoFill()
else -> videoView.setVideoFill()
}
}

override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
when (call.method) {
::isAttached.name -> isAttached(result)
Expand Down
2 changes: 1 addition & 1 deletion ios/Classes/PluginInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import Foundation

enum PluginInfo {
static let componentName = "flutter-sdk"
static let sdkVersion = "3.8.2-beta.1"
static let sdkVersion = "3.8.2-beta.2"
}
18 changes: 16 additions & 2 deletions ios/Classes/VideoView/FLVideoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class FLVideoView: NSObject, FlutterPlatformView {
}
methodChannel = FlutterMethodChannel(name: "video_view_\(viewId)_method_channel", binaryMessenger: messenger)
_view = VTVideoView()
_view.clipsToBounds = true;
super.init()

methodChannel.setMethodCallHandler { [weak self] (call, result) in
Expand All @@ -40,7 +41,8 @@ class FLVideoView: NSObject, FlutterPlatformView {
do {
let participantId: String? = try flutterArguments.asDictionary(argKey: "participant_id").decode()
let mediaStreamId: String? = try flutterArguments.asDictionary(argKey: "media_stream_id").decode()
try attach(participantId: participantId, mediaStreamId: mediaStreamId)
let scaleType: String? = try flutterArguments.asDictionary(argKey: "scale_type").decode()
try attach(participantId: participantId, mediaStreamId: mediaStreamId, scaleType: scaleType)
} catch {
completionHandler.failure(error)
}
Expand All @@ -65,7 +67,7 @@ class FLVideoView: NSObject, FlutterPlatformView {
completionHandler.success(flutterConvertible: false) // TODO: Implement this properly
}

private func attach(participantId: String?, mediaStreamId: String?) throws {
private func attach(participantId: String?, mediaStreamId: String?, scaleType: String?) throws {
guard
let participantId = participantId, participantId != "",
let mediaStreamId = mediaStreamId, mediaStreamId != "",
Expand All @@ -78,8 +80,20 @@ class FLVideoView: NSObject, FlutterPlatformView {
_view.unattach()
return
}
updateScaleType(view: _view, scaleType: scaleType)
_view.attach(participant: participantObject, stream: mediaStreamObject)
}

private func updateScaleType(view: VTVideoView, scaleType: String?, animated: Bool = false) {
switch scaleType {
case "SCALE_TYPE_FILL":
view.contentFill(true, animated: animated)
case "SCALE_TYPE_FIT":
view.contentFill(false, animated: animated)
default:
break
}
}
}

extension FLVideoView: FlutterBinding {
Expand Down
3 changes: 2 additions & 1 deletion lib/dolbyio_comms_sdk_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export 'src/sdk_api/models/spatial.dart'
export 'src/sdk_api/models/video_presentation.dart' show VideoPresentation;
export 'src/sdk_api/models/streams.dart' show MediaStream, MediaStreamType;
export 'src/dolbyio_comms_sdk_native_events.dart' show Event;
export 'src/sdk_api/view/video_view.dart' show VideoView, VideoViewController;
export 'src/sdk_api/view/video_view.dart'
show VideoView, VideoViewController, ScaleType;
export 'src/sdk_api/models/audio.dart'
show AudioCaptureOptions, AudioCaptureMode, NoiseReduction;
40 changes: 35 additions & 5 deletions lib/src/sdk_api/view/video_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,28 @@ class VideoView extends StatefulWidget {
/// @internal
final VideoViewController? videoViewController;

/// @internal
final ScaleType? scaleType;

/// A constructor that should be used when the [VideoView] is an element in a collection
/// widget, such as a [GridView] or a [ListView]. The constructor requires providing the
/// [Participant] for whom the [MediaStream] should be displayed, the [MediaStream], and an
/// [Participant] for whom the [MediaStream] should be displayed, the [MediaStream], the [ScaleType], and an
/// optional [Key].
const VideoView.withMediaStream(
{required this.participant, required this.mediaStream, Key? key})
{required this.participant,
required this.mediaStream,
this.scaleType = ScaleType.fill,
Key? key})
: videoViewController = null,
super(key: key);

/// A constructor that shuold be used when the [VideoView] is used as a stand-alone widget
/// A constructor that should be used when the [VideoView] is used as a stand-alone widget
/// outside of collection widgets such as [GridView] or [ListView]. The constructor requires
/// providing the [VideoViewController] and, optionally, a [Key].
const VideoView({required this.videoViewController, Key? key})
/// providing the [VideoViewController], the [ScaleType], and an optional [Key].
const VideoView(
{required this.videoViewController,
this.scaleType = ScaleType.fill,
Key? key})
: participant = null,
mediaStream = null,
super(key: key);
Expand All @@ -122,6 +131,7 @@ class _VideoViewState extends State<VideoView> {
Participant? _participant;
MediaStream? _mediaStream;
int viewNumber;
ScaleType? _scaleType;
MethodChannel? _methodChannel;

_VideoViewState() : viewNumber = _getNextViewNubmer();
Expand All @@ -130,13 +140,15 @@ class _VideoViewState extends State<VideoView> {
void initState() {
widget.videoViewController?._updateState(this);
_updateParticipantAndStream();
_scaleType = widget.scaleType;
super.initState();
}

@override
void didUpdateWidget(covariant VideoView oldWidget) {
widget.videoViewController?._updateState(this);
_updateParticipantAndStream();
_scaleType = widget.scaleType;
super.didUpdateWidget(oldWidget);
}

Expand Down Expand Up @@ -165,6 +177,11 @@ class _VideoViewState extends State<VideoView> {
creationParams["media_stream_label"] = mediaStreamLabel;
}

final scaleType = _scaleType?._value;
if (scaleType != null) {
creationParams["scale_type"] = scaleType;
}

if (defaultTargetPlatform == TargetPlatform.android) {
_methodChannel?.invokeMethod("attach", creationParams);

Expand Down Expand Up @@ -264,3 +281,16 @@ class _VideoViewState extends State<VideoView> {
return Future.error("The VideoView has not been instantiated yet.");
}
}

/// The ScaleType enum lets you select how you want to display a video stream in the VideoView area.
enum ScaleType {
/// Modifies the hight and width of a video stream to match the VideoView area.
fill('SCALE_TYPE_FILL'),

/// Scales a video stream to fit the VideoView area but keeping the video aspect ratio.
fit('SCALE_TYPE_FIT');

final String _value;

const ScaleType(this._value);
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: dolbyio_comms_sdk_flutter
description: >
Dolby.io Communications SDK for Flutter allows you to create high-quality video conferencing
applications for multiple platforms using a single codebase.
version: 3.8.2-beta.1
version: 3.8.2-beta.2
homepage: https://github.com/DolbyIO/comms-sdk-flutter

environment:
Expand Down
3 changes: 2 additions & 1 deletion scripts/run-mocked-integration-tests-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ avdmanager list avd
echo "Create system image: $system_image"

echo "no" | avdmanager --verbose create avd --force --name $device_name --abi "default/x86" --package "$system_image"
echo "disk.dataPartition.size=1024MB" >> ~/.android/avd/$device_name.avd/config.ini
echo "disk.dataPartition.size=8G" >> ~/.android/avd/$device_name.avd/config.ini
echo "hw.ramSize = 3.072MB" >> ~/.android/avd/$device_name.avd/config.ini
touch ~/.android/emu-update-last-check.ini

ls -la ~/.android/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,12 @@ public void attach(@NotNull String participantId, @NotNull MediaStream mediaStre
this.peerId = participantId;
this.stream = mediaStream;
}

public void setVideoFill() {

}

public void setVideoFit() {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ open class VTVideoView: UIView {
public func unattach() {
fatalError("UnImplemented")
}

public func contentFill(_ fill: Bool, animated: Bool) {
fatalError("UnImplemented")
}
}
23 changes: 12 additions & 11 deletions test_app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ PODS:
- Flutter
- permission_handler_apple (9.0.4):
- Flutter
- SDWebImage (5.15.6):
- SDWebImage/Core (= 5.15.6)
- SDWebImage/Core (5.15.6)
- shared_preferences_ios (0.0.1):
- SDWebImage (5.15.7):
- SDWebImage/Core (= 5.15.7)
- SDWebImage/Core (5.15.7)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- SwiftyGif (5.4.4)
- VoxeetSDK (3.8.3)

Expand All @@ -55,7 +56,7 @@ DEPENDENCIES:
- Flutter (from `Flutter`)
- integration_test (from `.symlinks/plugins/integration_test/ios`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)

SPEC REPOS:
trunk:
Expand All @@ -76,22 +77,22 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/integration_test/ios"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
shared_preferences_ios:
:path: ".symlinks/plugins/shared_preferences_ios/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/ios"

SPEC CHECKSUMS:
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
dolbyio_comms_sdk_flutter: 133e16950e406a6f6ee4f786a835fc6e01bb9f95
file_picker: 817ab1d8cd2da9d2da412a417162deee3500fc95
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5
permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
SDWebImage: d47d81bea8a77187896b620dc79c3c528e8906b9
shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad
SDWebImage: 25bac438318faf37e35650619ebc288a9061d292
shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
VoxeetSDK: 164aa55773192104d4a57a6952507722330d15f1

PODFILE CHECKSUM: ad35eb4c4f8efa60cf39d5ae575517a0e24a77af

COCOAPODS: 1.11.3
COCOAPODS: 1.12.0
2 changes: 1 addition & 1 deletion test_app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ packages:
path: ".."
relative: true
source: path
version: "3.8.2-beta.1"
version: "3.8.2-beta.2"
fake_async:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion test_app/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: dolbyio_comms_sdk_flutter_example
description: Demonstrates how to use the dolbyio_comms_sdk_flutter plugin.

version: 3.8.2+1
version: 3.8.2+2

# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
Expand Down

0 comments on commit b24ee6b

Please sign in to comment.