Skip to content

Commit

Permalink
Merge branch 'release/sora-android-sdk-2022.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
miosakuma committed Jun 29, 2022
2 parents cdb978c + a9b6326 commit 541c062
Show file tree
Hide file tree
Showing 19 changed files with 336 additions and 100 deletions.
38 changes: 38 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,44 @@

## develop

## sora-andoroid-sdk-2022.3.0

- [ADD] 解像度の調整を ON/OFF する UI を追加する
- @enm10k
- [ADD] プロキシを gradle.properties ファイルから設定できるようにする
- @enm10k
- [UPDATE] システム条件を更新する
- Android Studio 2021.2.1 以降
- WebRTC SFU Sora 2022.1 以降
- Sora Android SDK 2022.3.0 以降
- @miosakuma
- [UPDATE] compileSdkVersion を 31 に上げる
- AndroidManifest.xml の Activity に `android:exported="true"` を明示的に記載する
- @miosakuma
- [UPDATE] Gradle のバージョンを 7.4.2 に上げる
- @miosakuma
- [UPDATE] Gktlint のバージョンを 0.45.2 に上げる
- @miosakuma
- [UPDATE] 依存ライブラリを更新する
- com.android.tools.build:gradle を 7.2.1 に上げる
- org.jlleitschuh.gradle:ktlint-gradle を 10.3.0 に上げる
- com.google.code.gson:gson を 2.9.0 に上げる
- androidx.appcompat:appcompat を 1.4.2 に上げる
- com.google.android.material:material を 1.6.1 に上げる
- androidx.constraintlayout:constraintlayout を 2.1.4 に上げる
- androidx.navigation:navigation-fragment-ktx を 2.4.2 に上げる
- androidx.navigation:navigation-ui-ktx を 2.4.2 に上げる
- androidx.compose.ui:ui:1.1.1 に上げる
- androidx.compose.material:material を 1.1.1 に上げる
- androidx.compose.material:material-icons-extended を 1.1.1 に上げる
- androidx.activity:activity-compose を 1.4.0 に上げる
- com.github.permissions-dispatcher:permissionsdispatcher を 4.9.2 に上げる
- com.github.permissions-dispatcher:permissionsdispatcher-processor を 4.9.2 に上げる
- com.github.ben-manes:gradle-versions-plugin を 0.42.0 に上げる
- @miosakuma
- [FIX] メッセージングアプリが H.264 で接続中の別クライアントがいるときに接続エラーになる問題を修正する
- @miosakuma

## sora-andoroid-sdk-2022.2.0

- [UPDATE] システム条件を更新する
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ Please read https://github.com/shiguredo/oss before use.
## システム条件

- Android 8.0 以降 (エミュレーターでの動作は保証しません)
- Android Studio 2021.1.1 以降
- WebRTC SFU Sora 2021.2 以降
- Sora Android SDK 2022.2.0 以降
- Android Studio 2021.2.1 以降
- WebRTC SFU Sora 2022.1 以降
- Sora Android SDK 2022.3.0 以降

## サンプルの使い方

Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ apply plugin: "com.github.ben-manes.versions"

buildscript {
ext.kotlin_version = '1.6.10'
ext.sora_android_sdk_version = '2022.2.0'
ext.sora_android_sdk_version = '2022.3.0'

repositories {
google()
gradlePluginPortal()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'com.android.tools.build:gradle:7.2.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"

classpath "com.github.ben-manes:gradle-versions-plugin:0.41.0"
classpath "org.jlleitschuh.gradle:ktlint-gradle:10.2.1"
classpath "com.github.ben-manes:gradle-versions-plugin:0.42.0"
classpath "org.jlleitschuh.gradle:ktlint-gradle:10.3.0"
}

// デバッグ用: true に設定すると wss ではなく ws で接続できる
Expand Down
7 changes: 7 additions & 0 deletions gradle.properties.example
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,10 @@ channel_id = sora
# e.g.) signaling_metadata = {\\"spam\\":\\"egg\\"}
# This setting is required. If you do not want to use it, set it to blank.
signaling_metadata =

# Proxy
proxy_agent =
proxy_hostname =
proxy_port =
proxy_username =
proxy_password =
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Jan 20 16:14:02 JST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
35 changes: 21 additions & 14 deletions samples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: 'kotlin-kapt'
apply plugin: 'org.jlleitschuh.gradle.ktlint'

android {
compileSdkVersion 30
compileSdkVersion 31
defaultConfig {
applicationId "jp.shiguredo.sora.sample"
targetSdkVersion 30
Expand All @@ -17,6 +17,13 @@ android {
resValue("string", "channelId", "\"${channel_id}\"")
buildConfigField("String", "SIGNALING_METADATA", "\"${signaling_metadata}\"")

// プロキシの設定
buildConfigField("String", "PROXY_AGENT", "\"${proxy_agent}\"")
buildConfigField("String", "PROXY_HOSTNAME", "\"${proxy_hostname}\"")
buildConfigField("String", "PROXY_PORT", "\"${proxy_port}\"")
buildConfigField("String", "PROXY_USERNAME", "\"${proxy_username}\"")
buildConfigField("String", "PROXY_PASSWORD", "\"${proxy_password}\"")

manifestPlaceholders = [usesCleartextTraffic: usesCleartextTraffic];
}

Expand Down Expand Up @@ -71,7 +78,7 @@ configurations {
}

ktlint {
version = "0.43.2"
version = "0.45.2"
android = false
outputToConsole = true
reporters {
Expand All @@ -84,23 +91,23 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}"
implementation "org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}"

implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.google.code.gson:gson:2.9.0'

implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation "androidx.cardview:cardview:1.0.0"
implementation 'androidx.recyclerview:recyclerview:1.2.1'

implementation 'com.google.android.material:material:1.3.0'
implementation 'com.google.android.material:material:1.6.1'
implementation 'com.jaredrummler:material-spinner:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
implementation 'androidx.compose.ui:ui:1.0.3'
implementation 'androidx.compose.material:material:1.0.3'
implementation "androidx.compose.material:material-icons-extended:1.0.3"
implementation 'androidx.activity:activity-compose:1.3.1'

ext.pd_version = '4.9.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.4.2'
implementation 'androidx.compose.ui:ui:1.1.1'
implementation 'androidx.compose.material:material:1.1.1'
implementation "androidx.compose.material:material-icons-extended:1.1.1"
implementation 'androidx.activity:activity-compose:1.4.0'

ext.pd_version = '4.9.2'
implementation "com.github.permissions-dispatcher:permissionsdispatcher:${pd_version}"
kapt "com.github.permissions-dispatcher:permissionsdispatcher-processor:${pd_version}"

Expand Down
42 changes: 27 additions & 15 deletions samples/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
<activity
android:name=".ui.MessagingActivity"
android:exported="false" />
<activity android:name=".ui.MainActivity">
<activity android:name=".ui.MainActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -43,27 +44,34 @@
<activity
android:name=".ui.VoiceChatRoomSetupActivity"
android:configChanges="orientation|screenSize"
android:label="ボイスチャット" />
android:label="ボイスチャット"
android:exported="true" />
<activity
android:name=".ui.VideoChatRoomSetupActivity"
android:configChanges="orientation|screenSize"
android:label="ビデオチャット" />
<activity
android:label="ビデオチャット"
android:exported="true" />

<activity
android:name=".ui.SpotlightRoomSetupActivity"
android:configChanges="orientation|screenSize"
android:label="スポットライト" />
android:label="スポットライト"
android:exported="true" />
<activity
android:name=".ui.ScreencastSetupActivity"
android:configChanges="orientation|screenSize"
android:label="スクリーンキャスト" />
<activity
android:label="スクリーンキャスト"
android:exported="true" />
<activity
android:name=".ui.EffectedVideoChatSetupActivity"
android:configChanges="orientation|screenSize"
android:label="ビデオエフェクト" />
<activity
android:label="ビデオエフェクト"
android:exported="true" />
<activity
android:name=".ui.SimulcastSetupActivity"
android:configChanges="orientation|screenSize"
android:label="サイマルキャスト" />
android:label="サイマルキャスト"
android:exported="true" />
<!--
以下は実際にWebRTCを利用して動画/音声の通話を行うActivity
セッション中にActivityが破壊されないように次のどちらかの設定を行う
Expand All @@ -75,7 +83,8 @@
<activity
android:name=".ui.VideoChatRoomActivity"
android:configChanges="orientation|screenSize"
android:label="ビデオチャット">
android:label="ビデオチャット"
android:exported="true" >

<!-- <intent-filter> -->
<!-- <action android:name="android.intent.action.MAIN" /> -->
Expand All @@ -87,9 +96,10 @@
<activity
android:name=".ui.VoiceChatRoomActivity"
android:configChanges="orientation|screenSize"
android:label="ボイスチャット" />
android:label="ボイスチャット"
android:exported="true" />

<service
<service
android:name=".screencast.SoraScreencastService"
android:configChanges="orientation|screenSize"
android:enabled="true"
Expand All @@ -98,11 +108,13 @@
<activity
android:name=".ui.EffectedVideoChatActivity"
android:configChanges="orientation|screenSize"
android:label="エフェクト付きビデオチャット" />
android:label="エフェクト付きビデオチャット"
android:exported="true" />
<activity
android:name=".ui.SimulcastActivity"
android:configChanges="orientation|screenSize"
android:label="Simulcast" />
android:label="Simulcast"
android:exported="true" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package jp.shiguredo.sora.sample.facade
import android.content.Context
import android.media.MediaRecorder
import android.os.Handler
import jp.shiguredo.sora.sample.BuildConfig
import jp.shiguredo.sora.sample.camera.CameraVideoCapturerFactory
import jp.shiguredo.sora.sample.camera.DefaultCameraVideoCapturerFactory
import jp.shiguredo.sora.sample.option.SoraRoleType
Expand All @@ -24,9 +25,11 @@ import org.webrtc.AudioTrack
import org.webrtc.CameraVideoCapturer
import org.webrtc.EglBase
import org.webrtc.MediaStream
import org.webrtc.ProxyType
import org.webrtc.RTCStatsReport
import org.webrtc.RtpParameters
import org.webrtc.SurfaceViewRenderer
import java.lang.Exception

class SoraVideoChannel(
private val context: Context,
Expand All @@ -39,6 +42,7 @@ class SoraVideoChannel(
private val signalingMetadata: Any? = "",
private val signalingNotifyMetatada: Any? = null,
private val clientId: String? = null,
private val bundleId: String? = null,
private val spotlight: Boolean = false,
private val spotlightNumber: Int? = null,
private val spotlightFocusRid: SoraVideoOption.SpotlightRid? = null,
Expand All @@ -52,6 +56,7 @@ class SoraVideoChannel(
private val simulcastRid: SoraVideoOption.SimulcastRid? = null,
private val videoFPS: Int = 30,
private val fixedResolution: Boolean = false,
private val resolutionAdjustment: SoraVideoOption.ResolutionAdjustment? = null,
private val cameraFacing: Boolean = true,
private val videoCodec: SoraVideoOption.Codec = SoraVideoOption.Codec.VP9,
private val audioCodec: SoraAudioOption.Codec = SoraAudioOption.Codec.OPUS,
Expand Down Expand Up @@ -233,7 +238,6 @@ class SoraVideoChannel(
)

val mediaOption = SoraMediaOption().apply {

if (roleType.hasUpstream()) {
if (audioEnabled) {
enableAudioUpstream()
Expand Down Expand Up @@ -266,7 +270,7 @@ class SoraVideoChannel(
option.spotlightNumber = spotlightNumber
option.spotlightFocusRid = spotlightFocusRid
option.spotlightUnfocusRid = spotlightUnfocusRid
enableSpotlight(option)
enableSpotlight(option, this@SoraVideoChannel.simulcast)
}

videoCodec = this@SoraVideoChannel.videoCodec
Expand Down Expand Up @@ -300,6 +304,32 @@ class SoraVideoChannel(
useStereoInput = true
}
}

if (resolutionAdjustment != null) {
this.hardwareVideoEncoderResolutionAdjustment = resolutionAdjustment
}

// プロキシ
if (BuildConfig.PROXY_HOSTNAME.isNotBlank()) {
this.proxy.type = ProxyType.HTTPS
this.proxy.hostname = BuildConfig.PROXY_HOSTNAME

// エージェントは指定されている場合のみデフォルト値を上書きする
if (BuildConfig.PROXY_AGENT.isNotBlank()) {
this.proxy.agent = BuildConfig.PROXY_AGENT
}

try {
this.proxy.port = BuildConfig.PROXY_PORT.toInt()
} catch (e: Exception) {
SoraLogger.e(TAG, "failed to set SoraMediaOption.proxy.port", e)
}

if (BuildConfig.PROXY_USERNAME.isNotBlank()) {
this.proxy.username = BuildConfig.PROXY_USERNAME
this.proxy.password = BuildConfig.PROXY_PASSWORD
}
}
}

val peerConnectionOption = PeerConnectionOption().apply {
Expand All @@ -318,6 +348,7 @@ class SoraVideoChannel(
mediaOption = mediaOption,
listener = channelListener,
clientId = clientId,
bundleId = bundleId,
peerConnectionOption = peerConnectionOption
)
mediaChannel!!.connect()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package jp.shiguredo.sora.sample.option

import jp.shiguredo.sora.sdk.channel.option.SoraVideoOption

class SoraFrameSize {
companion object {
/*
* NOTE: Kotlin の Map は順序保証あり
*
* > Entries of the map are iterated in the order they were specified.
* https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/map-of.html
*/
val landscape = mapOf(
"QCIF: 176x144" to SoraVideoOption.FrameSize.Landscape.QCIF,
"HQVGA: 240x160" to SoraVideoOption.FrameSize.Landscape.HQVGA,
"QVGA: 320x240" to SoraVideoOption.FrameSize.Landscape.QVGA,
"VGA: 640x480" to SoraVideoOption.FrameSize.Landscape.VGA,
"HD: 1280x720" to SoraVideoOption.FrameSize.Landscape.HD,
"FHD: 1920x1080" to SoraVideoOption.FrameSize.Landscape.FHD,
"3840x1920" to SoraVideoOption.FrameSize.Landscape.Res3840x1920,
"UHD: 3840x2160" to SoraVideoOption.FrameSize.Landscape.UHD3840x2160,
"4096x2160" to SoraVideoOption.FrameSize.Landscape.UHD4096x2160,
)
val portrait = mapOf(
"QCIF: 144x176" to SoraVideoOption.FrameSize.Portrait.QCIF,
"HQVGA: 160x240" to SoraVideoOption.FrameSize.Portrait.HQVGA,
"QVGA: 240x320" to SoraVideoOption.FrameSize.Portrait.QVGA,
"VGA: 480x640" to SoraVideoOption.FrameSize.Portrait.VGA,
"HD: 720x1280" to SoraVideoOption.FrameSize.Portrait.HD,
"FHD: 1080x1920" to SoraVideoOption.FrameSize.Portrait.FHD,
"3840x1920" to SoraVideoOption.FrameSize.Portrait.Res1920x3840,
"UHD: 3840x2160" to SoraVideoOption.FrameSize.Portrait.UHD2160x3840,
"4096x2160" to SoraVideoOption.FrameSize.Portrait.UHD2160x4096,
)

val all = landscape + portrait
}
}
Loading

0 comments on commit 541c062

Please sign in to comment.