Merge branch 'login_design_sikander' into 'development'
laser and hair clinic added. See merge request Cloud_Solution/diplomatic-quarter!522development
@ -0,0 +1,35 @@
|
|||||||
|
//package com.cloud.diplomaticquarterapp
|
||||||
|
package com.ejada.hmg
|
||||||
|
|
||||||
|
import io.flutter.app.FlutterApplication
|
||||||
|
import io.flutter.plugin.common.PluginRegistry
|
||||||
|
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
|
||||||
|
import io.flutter.plugins.GeneratedPluginRegistrant
|
||||||
|
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService
|
||||||
|
|
||||||
|
class Application : FlutterApplication(), PluginRegistrantCallback {
|
||||||
|
override fun onCreate() {
|
||||||
|
super.onCreate()
|
||||||
|
FlutterFirebaseMessagingService.setPluginRegistrant(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun registerWith(registry: PluginRegistry) {
|
||||||
|
io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//import io.flutter.app.FlutterApplication
|
||||||
|
//import io.flutter.plugin.common.PluginRegistry
|
||||||
|
//import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
|
||||||
|
//import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService
|
||||||
|
//
|
||||||
|
//class Application : FlutterApplication(), PluginRegistrantCallback {
|
||||||
|
// override fun onCreate() {
|
||||||
|
// super.onCreate()
|
||||||
|
// FlutterFirebaseMessagingService.setPluginRegistrant(this)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// override fun registerWith(registry: PluginRegistry?) {
|
||||||
|
// FirebaseCloudMessagingPluginRegistrant.registerWith(registry)
|
||||||
|
// }
|
||||||
|
//}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
//package com.cloud.diplomaticquarterapp
|
||||||
|
package com.ejada.hmg
|
||||||
|
|
||||||
|
import io.flutter.plugin.common.PluginRegistry
|
||||||
|
import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin
|
||||||
|
|
||||||
|
object FirebaseCloudMessagingPluginRegistrant {
|
||||||
|
fun registerWith(registry: PluginRegistry?) {
|
||||||
|
if (alreadyRegisteredWith(registry)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun alreadyRegisteredWith(registry: PluginRegistry?): Boolean {
|
||||||
|
val key: String? = FirebaseCloudMessagingPluginRegistrant::class.java.canonicalName
|
||||||
|
if (registry?.hasPlugin(key)!!) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
registry.registrarFor(key)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,74 @@
|
|||||||
|
{
|
||||||
|
"agcgw":{
|
||||||
|
"backurl":"connect-drcn.hispace.hicloud.com",
|
||||||
|
"url":"connect-drcn.dbankcloud.cn",
|
||||||
|
"websocketbackurl":"connect-ws-drcn.hispace.dbankcloud.com",
|
||||||
|
"websocketurl":"connect-ws-drcn.hispace.dbankcloud.cn"
|
||||||
|
},
|
||||||
|
"agcgw_all":{
|
||||||
|
"CN":"connect-drcn.dbankcloud.cn",
|
||||||
|
"CN_back":"connect-drcn.hispace.hicloud.com",
|
||||||
|
"DE":"connect-dre.dbankcloud.cn",
|
||||||
|
"DE_back":"connect-dre.hispace.hicloud.com",
|
||||||
|
"RU":"connect-drru.dbankcloud.cn",
|
||||||
|
"RU_back":"connect-drru.hispace.hicloud.com",
|
||||||
|
"SG":"connect-dra.dbankcloud.cn",
|
||||||
|
"SG_back":"connect-dra.hispace.hicloud.com"
|
||||||
|
},
|
||||||
|
"client":{
|
||||||
|
"cp_id":"2640966000002322881",
|
||||||
|
"product_id":"736430079244816567",
|
||||||
|
"client_id":"563735388191982656",
|
||||||
|
"client_secret":"650C7C799812AFFD53A10C7756CF05FB9F215A7E49032ABA8EBF3E14B77535CF",
|
||||||
|
"project_id":"736430079244816567",
|
||||||
|
"app_id":"102857389",
|
||||||
|
"api_key":"CgB6e3x9DJzMgRCmnT6dyUEkp6UsIfddb6l3w0ZEXzeiRMHEFi3400Z5fJ5qaHneU0OrAI/JRpk+DMGVs3QpUxlI",
|
||||||
|
"package_name":"com.ejada.hmg"
|
||||||
|
},
|
||||||
|
"oauth_client":{
|
||||||
|
"client_id":"102857389",
|
||||||
|
"client_type":1
|
||||||
|
},
|
||||||
|
"app_info":{
|
||||||
|
"app_id":"102857389",
|
||||||
|
"package_name":"com.ejada.hmg"
|
||||||
|
},
|
||||||
|
"service":{
|
||||||
|
"analytics":{
|
||||||
|
"collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
|
||||||
|
"collector_url_ru":"datacollector-drru.dt.hicloud.com,datacollector-drru.dt.dbankcloud.cn",
|
||||||
|
"collector_url_sg":"datacollector-dra.dt.hicloud.com,datacollector-dra.dt.dbankcloud.cn",
|
||||||
|
"collector_url_de":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn",
|
||||||
|
"collector_url_cn":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
|
||||||
|
"resource_id":"p1",
|
||||||
|
"channel_id":""
|
||||||
|
},
|
||||||
|
"search":{
|
||||||
|
"url":"https://search-drcn.cloud.huawei.com"
|
||||||
|
},
|
||||||
|
"cloudstorage":{
|
||||||
|
"storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn"
|
||||||
|
},
|
||||||
|
"ml":{
|
||||||
|
"mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"region":"CN",
|
||||||
|
"configuration_version":"3.0",
|
||||||
|
"appInfos":[
|
||||||
|
{
|
||||||
|
"package_name":"com.ejada.hmg",
|
||||||
|
"client":{
|
||||||
|
"app_id":"102857389"
|
||||||
|
},
|
||||||
|
"app_info":{
|
||||||
|
"package_name":"com.ejada.hmg",
|
||||||
|
"app_id":"102857389"
|
||||||
|
},
|
||||||
|
"oauth_client":{
|
||||||
|
"client_type":1,
|
||||||
|
"client_id":"102857389"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"client":{
|
||||||
|
"appType":"1",
|
||||||
|
"cp_id":"2640966000002322881",
|
||||||
|
"product_id":"736430079244816567",
|
||||||
|
"client_id":"563735388191982656",
|
||||||
|
"client_secret":"650C7C799812AFFD53A10C7756CF05FB9F215A7E49032ABA8EBF3E14B77535CF",
|
||||||
|
"project_id":"736430079244816567",
|
||||||
|
"app_id":"102857389",
|
||||||
|
"api_key":"CgB6e3x9DJzMgRCmnT6dyUEkp6UsIfddb6l3w0ZEXzeiRMHEFi3400Z5fJ5qaHneU0OrAI/JRpk+DMGVs3QpUxlI",
|
||||||
|
"package_name":"com.ejada.hmg"
|
||||||
|
},
|
||||||
|
"configuration_version":"1.0"
|
||||||
|
}
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
//package com.cloud.diplomaticquarterapp
|
||||||
|
package com.ejada.hmg
|
||||||
|
|
||||||
|
import com.facebook.stetho.Stetho
|
||||||
|
import io.flutter.app.FlutterApplication
|
||||||
|
import io.flutter.plugin.common.PluginRegistry
|
||||||
|
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
|
||||||
|
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService
|
||||||
|
|
||||||
|
class Application : FlutterApplication(), PluginRegistrantCallback {
|
||||||
|
override fun onCreate() {
|
||||||
|
super.onCreate()
|
||||||
|
FlutterFirebaseMessagingService.setPluginRegistrant(this)
|
||||||
|
|
||||||
|
// Stetho.initializeWithDefaults(this);
|
||||||
|
// Create an InitializerBuilder
|
||||||
|
// Create an InitializerBuilder
|
||||||
|
val initializerBuilder = Stetho.newInitializerBuilder(this)
|
||||||
|
|
||||||
|
|
||||||
|
// Enable Chrome DevTools
|
||||||
|
initializerBuilder.enableWebKitInspector(
|
||||||
|
Stetho.defaultInspectorModulesProvider(this)
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enable command line interface
|
||||||
|
initializerBuilder.enableDumpapp(
|
||||||
|
Stetho.defaultDumperPluginsProvider(this)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
// Use the InitializerBuilder to generate an Initializer
|
||||||
|
val initializer = initializerBuilder.build()
|
||||||
|
|
||||||
|
|
||||||
|
// Initialize Stetho with the Initializer
|
||||||
|
Stetho.initialize(initializer)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun registerWith(registry: PluginRegistry) {
|
||||||
|
io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//import io.flutter.app.FlutterApplication
|
||||||
|
//import io.flutter.plugin.common.PluginRegistry
|
||||||
|
//import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
|
||||||
|
//import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService
|
||||||
|
//
|
||||||
|
//class Application : FlutterApplication(), PluginRegistrantCallback {
|
||||||
|
// override fun onCreate() {
|
||||||
|
// super.onCreate()
|
||||||
|
// FlutterFirebaseMessagingService.setPluginRegistrant(this)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// override fun registerWith(registry: PluginRegistry?) {
|
||||||
|
// FirebaseCloudMessagingPluginRegistrant.registerWith(registry)
|
||||||
|
// }
|
||||||
|
//}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
//package com.cloud.diplomaticquarterapp
|
||||||
|
package com.ejada.hmg
|
||||||
|
|
||||||
|
import io.flutter.plugin.common.PluginRegistry
|
||||||
|
import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin
|
||||||
|
|
||||||
|
object FirebaseCloudMessagingPluginRegistrant {
|
||||||
|
fun registerWith(registry: PluginRegistry?) {
|
||||||
|
if (alreadyRegisteredWith(registry)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun alreadyRegisteredWith(registry: PluginRegistry?): Boolean {
|
||||||
|
val key: String? = FirebaseCloudMessagingPluginRegistrant::class.java.canonicalName
|
||||||
|
if (registry?.hasPlugin(key)!!) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
registry.registrarFor(key)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
package com.ejada.hmg.opentok
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.FrameLayout
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import com.ejada.hmg.R
|
||||||
|
import io.flutter.plugin.common.StandardMessageCodec
|
||||||
|
import io.flutter.plugin.platform.PlatformView
|
||||||
|
import io.flutter.plugin.platform.PlatformViewFactory
|
||||||
|
|
||||||
|
class LocalVideoFactory : PlatformViewFactory(StandardMessageCodec.INSTANCE) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private lateinit var view: LocalVideoPlatformView
|
||||||
|
|
||||||
|
fun getViewInstance(context: Context): LocalVideoPlatformView {
|
||||||
|
if(!this::view.isInitialized) {
|
||||||
|
view = LocalVideoPlatformView(context)
|
||||||
|
}
|
||||||
|
|
||||||
|
return view
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun create(context: Context, viewId: Int, args: Any?): PlatformView {
|
||||||
|
return getViewInstance(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LocalVideoPlatformView(context: Context) : PlatformView {
|
||||||
|
private val videoContainer: LocalVideoContainer = LocalVideoContainer(context)
|
||||||
|
|
||||||
|
val container get() = videoContainer.publisherContainer
|
||||||
|
|
||||||
|
override fun getView(): View {
|
||||||
|
return videoContainer
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun dispose() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LocalVideoContainer @JvmOverloads constructor(
|
||||||
|
context: Context,
|
||||||
|
attrs: AttributeSet? = null,
|
||||||
|
defStyle: Int = 0,
|
||||||
|
defStyleRes: Int = 0
|
||||||
|
) : LinearLayout(context, attrs, defStyle, defStyleRes) {
|
||||||
|
|
||||||
|
var publisherContainer: FrameLayout private set
|
||||||
|
|
||||||
|
init {
|
||||||
|
val view = LayoutInflater.from(context).inflate(R.layout.local_video, this, true)
|
||||||
|
publisherContainer = view.findViewById(R.id.publisher_container)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,170 @@
|
|||||||
|
package com.ejada.hmg.opentok
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
|
import android.util.Log
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import com.facebook.stetho.urlconnection.StethoURLConnectionManager
|
||||||
|
import com.opentok.android.*
|
||||||
|
import io.flutter.embedding.engine.FlutterEngine
|
||||||
|
import io.flutter.embedding.engine.plugins.util.GeneratedPluginRegister
|
||||||
|
import io.flutter.plugin.common.MethodCall
|
||||||
|
import io.flutter.plugin.common.MethodChannel
|
||||||
|
|
||||||
|
|
||||||
|
enum class OpenTokSDKState {
|
||||||
|
LOGGED_OUT,
|
||||||
|
LOGGED_IN,
|
||||||
|
WAIT,
|
||||||
|
ERROR
|
||||||
|
}
|
||||||
|
|
||||||
|
class OpenTok(private var context: Context, private var flutterEngine: FlutterEngine){
|
||||||
|
private lateinit var remoteVideoPlatformView: RemoteVideoPlatformView
|
||||||
|
private lateinit var localVideoPlatformView: LocalVideoPlatformView
|
||||||
|
|
||||||
|
init {
|
||||||
|
remoteVideoPlatformView = RemoteVideoFactory.getViewInstance(context)
|
||||||
|
flutterEngine
|
||||||
|
.platformViewsController
|
||||||
|
.registry
|
||||||
|
.registerViewFactory("remote-video-container", RemoteVideoFactory())
|
||||||
|
|
||||||
|
localVideoPlatformView = LocalVideoFactory.getViewInstance(context)
|
||||||
|
flutterEngine
|
||||||
|
.platformViewsController
|
||||||
|
.registry
|
||||||
|
.registerViewFactory("local-video-container", LocalVideoFactory())
|
||||||
|
}
|
||||||
|
|
||||||
|
private var session: Session? = null
|
||||||
|
private var publisher: Publisher? = null
|
||||||
|
private var subscriber: Subscriber? = null
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private val sessionListener: Session.SessionListener = object: Session.SessionListener {
|
||||||
|
override fun onConnected(session: Session) {
|
||||||
|
// Connected to session
|
||||||
|
Log.d("MainActivity", "Connected to session ${session.sessionId}")
|
||||||
|
|
||||||
|
publisher = Publisher.Builder(context).build().apply {
|
||||||
|
setPublisherListener(publisherListener)
|
||||||
|
renderer?.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL)
|
||||||
|
|
||||||
|
view.layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
|
||||||
|
localVideoPlatformView.container.addView(view)
|
||||||
|
}
|
||||||
|
|
||||||
|
notifyFlutter(OpenTokSDKState.LOGGED_IN)
|
||||||
|
session.publish(publisher)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDisconnected(session: Session) {
|
||||||
|
notifyFlutter(OpenTokSDKState.LOGGED_OUT)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStreamReceived(session: Session, stream: Stream) {
|
||||||
|
Log.d(
|
||||||
|
"MainActivity",
|
||||||
|
"onStreamReceived: New Stream Received " + stream.streamId + " in session: " + session.sessionId
|
||||||
|
)
|
||||||
|
if (subscriber == null) {
|
||||||
|
subscriber = Subscriber.Builder(context, stream).build().apply {
|
||||||
|
renderer?.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL)
|
||||||
|
setSubscriberListener(subscriberListener)
|
||||||
|
session.subscribe(this)
|
||||||
|
|
||||||
|
remoteVideoPlatformView.container.addView(view)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStreamDropped(session: Session, stream: Stream) {
|
||||||
|
Log.d(
|
||||||
|
"MainActivity",
|
||||||
|
"onStreamDropped: Stream Dropped: " + stream.streamId + " in session: " + session.sessionId
|
||||||
|
)
|
||||||
|
|
||||||
|
if (subscriber != null) {
|
||||||
|
subscriber = null
|
||||||
|
|
||||||
|
remoteVideoPlatformView.container.removeAllViews()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(session: Session, opentokError: OpentokError) {
|
||||||
|
Log.d("MainActivity", "Session error: " + opentokError.message)
|
||||||
|
notifyFlutter(OpenTokSDKState.ERROR)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val publisherListener: PublisherKit.PublisherListener = object : PublisherKit.PublisherListener {
|
||||||
|
override fun onStreamCreated(publisherKit: PublisherKit, stream: Stream) {
|
||||||
|
Log.d("MainActivity", "onStreamCreated: Publisher Stream Created. Own stream " + stream.streamId)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStreamDestroyed(publisherKit: PublisherKit, stream: Stream) {
|
||||||
|
Log.d("MainActivity", "onStreamDestroyed: Publisher Stream Destroyed. Own stream " + stream.streamId)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(publisherKit: PublisherKit, opentokError: OpentokError) {
|
||||||
|
Log.d("MainActivity", "PublisherKit onError: " + opentokError.message)
|
||||||
|
notifyFlutter(OpenTokSDKState.ERROR)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var subscriberListener: SubscriberKit.SubscriberListener = object : SubscriberKit.SubscriberListener {
|
||||||
|
override fun onConnected(subscriberKit: SubscriberKit) {
|
||||||
|
Log.d("MainActivity", "onConnected: Subscriber connected. Stream: " + subscriberKit.stream.streamId)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDisconnected(subscriberKit: SubscriberKit) {
|
||||||
|
Log.d("MainActivity", "onDisconnected: Subscriber disconnected. Stream: " + subscriberKit.stream.streamId)
|
||||||
|
notifyFlutter(OpenTokSDKState.LOGGED_OUT)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(subscriberKit: SubscriberKit, opentokError: OpentokError) {
|
||||||
|
Log.d("MainActivity", "SubscriberKit onError: " + opentokError.message)
|
||||||
|
notifyFlutter(OpenTokSDKState.ERROR)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun initSession(call: MethodCall, result: MethodChannel.Result) {
|
||||||
|
|
||||||
|
val apiKey = requireNotNull(call.argument<String>("apiKey"))
|
||||||
|
val sessionId = requireNotNull(call.argument<String>("sessionId"))
|
||||||
|
val token = requireNotNull(call.argument<String>("token"))
|
||||||
|
|
||||||
|
notifyFlutter(OpenTokSDKState.WAIT)
|
||||||
|
session = Session.Builder(context, apiKey, sessionId).build()
|
||||||
|
session?.setSessionListener(sessionListener)
|
||||||
|
session?.connect(token)
|
||||||
|
result.success("")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun swapCamera(call: MethodCall, result: MethodChannel.Result) {
|
||||||
|
publisher?.cycleCamera()
|
||||||
|
result.success("")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun toggleAudio(call: MethodCall, result: MethodChannel.Result) {
|
||||||
|
val publishAudio = requireNotNull(call.argument<Boolean>("publishAudio"))
|
||||||
|
publisher?.publishAudio = publishAudio
|
||||||
|
result.success("")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun toggleVideo(call: MethodCall, result: MethodChannel.Result) {
|
||||||
|
val publishVideo = requireNotNull(call.argument<Boolean>("publishVideo"))
|
||||||
|
publisher?.publishVideo = publishVideo
|
||||||
|
result.success("")
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun notifyFlutter(state: OpenTokSDKState) {
|
||||||
|
Handler(Looper.getMainLooper()).post {
|
||||||
|
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "OpenTok-Platform-Bridge")
|
||||||
|
.invokeMethod("updateState", state.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
package com.ejada.hmg.opentok
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.FrameLayout
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import com.ejada.hmg.R
|
||||||
|
import io.flutter.plugin.common.StandardMessageCodec
|
||||||
|
import io.flutter.plugin.platform.PlatformView
|
||||||
|
import io.flutter.plugin.platform.PlatformViewFactory
|
||||||
|
|
||||||
|
class RemoteVideoFactory : PlatformViewFactory(StandardMessageCodec.INSTANCE) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private lateinit var view: RemoteVideoPlatformView
|
||||||
|
|
||||||
|
fun getViewInstance(context: Context): RemoteVideoPlatformView {
|
||||||
|
if(!this::view.isInitialized) {
|
||||||
|
view = RemoteVideoPlatformView(context)
|
||||||
|
}
|
||||||
|
|
||||||
|
return view
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun create(context: Context, viewId: Int, args: Any?): PlatformView {
|
||||||
|
return getViewInstance(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RemoteVideoPlatformView(context: Context) : PlatformView {
|
||||||
|
private val videoContainer: RemoteVideoContainer = RemoteVideoContainer(context)
|
||||||
|
|
||||||
|
val container get() = videoContainer.subscriberContainer
|
||||||
|
|
||||||
|
override fun getView(): View {
|
||||||
|
return videoContainer
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun dispose() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RemoteVideoContainer @JvmOverloads constructor(
|
||||||
|
context: Context,
|
||||||
|
attrs: AttributeSet? = null,
|
||||||
|
defStyle: Int = 0,
|
||||||
|
defStyleRes: Int = 0
|
||||||
|
) : LinearLayout(context, attrs, defStyle, defStyleRes) {
|
||||||
|
|
||||||
|
var subscriberContainer: FrameLayout private set
|
||||||
|
|
||||||
|
init {
|
||||||
|
val view = LayoutInflater.from(context).inflate(R.layout.remote_video, this, true)
|
||||||
|
subscriberContainer = view.findViewById(R.id.subscriber_container)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
package com.ejada.hmg.utils
|
||||||
|
|
||||||
|
import com.ejada.hmg.MainActivity
|
||||||
|
import com.ejada.hmg.opentok.OpenTok
|
||||||
|
import io.flutter.embedding.engine.FlutterEngine
|
||||||
|
import io.flutter.plugin.common.MethodCall
|
||||||
|
import io.flutter.plugin.common.MethodChannel
|
||||||
|
|
||||||
|
class OpenTokPlatformBridge(private var flutterEngine: FlutterEngine, private var mainActivity: MainActivity) {
|
||||||
|
|
||||||
|
private lateinit var channel: MethodChannel
|
||||||
|
private lateinit var openTok: OpenTok
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val CHANNEL = "OpenTok-Platform-Bridge"
|
||||||
|
}
|
||||||
|
|
||||||
|
fun create(){
|
||||||
|
openTok = OpenTok(mainActivity, flutterEngine)
|
||||||
|
channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL)
|
||||||
|
channel.setMethodCallHandler { call: MethodCall, result: MethodChannel.Result ->
|
||||||
|
when (call.method) {
|
||||||
|
"initSession" -> {
|
||||||
|
openTok.initSession(call, result)
|
||||||
|
}
|
||||||
|
"swapCamera" -> {
|
||||||
|
openTok.swapCamera(call, result)
|
||||||
|
}
|
||||||
|
"toggleAudio" -> {
|
||||||
|
openTok.toggleAudio(call, result)
|
||||||
|
}
|
||||||
|
"toggleVideo" -> {
|
||||||
|
openTok.toggleVideo(call, result)
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
result.notImplemented()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.5 KiB |
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:layout_gravity="center_horizontal">
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/publisher_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#FF9800" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:layout_gravity="center_horizontal">
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/subscriber_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#3F51B5" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:text="Remote"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@ -1,4 +1,4 @@
|
|||||||
org.gradle.jvmargs=-Xmx1536M
|
org.gradle.jvmargs=-Xmx1536M
|
||||||
android.enableR8=true
|
android.enableR8=true
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 99 KiB |
|
Before Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 445 B |
|
Before Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 148 KiB |
|
After Width: | Height: | Size: 193 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 246 KiB |
|
Before Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 244 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 475 B |
|
Before Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |