Project documentation for integrating the MyHub one-to-one audio and video calling SDK into a Flutter application using the tested CallTestScreen.
SDK packagemyhub_live_sdk
Example projectmyhub_live_sdk_example
Repository accessAvailable on Bitbucket
1. Project and Bitbucket access
MyHub TechnologiesFlutterAndroidiOS
The SDK package is myhub_live_sdk. The tested Flutter example project is myhub_live_sdk_example.
Bitbucket: The SDK and example project are available on Bitbucket. Check the email shared by MyHub Technologies for the example-project repository URL, access invitation, and branch details.
This guide is for Flutter integration only. Customer projects only need to add the MyHub Live SDK dependency, configure platform permissions, and use the SDK APIs shown below.
2. Add the SDK dependency
Add the package to the main Flutter application's pubspec.yaml.
dependencies:
flutter:
sdk: flutter
myhub_live_sdk:
git:
url: git@bitbucket.org:bilwamindia/myhub_live_sdk.git
ref: main
# Required because CallTestScreen imports permission_handler directly.
permission_handler: 11.4.0
Add only myhub_live_sdk to the main project. The example screen also declares permission_handler because it requests camera and microphone permissions directly.
No manual native SDK setup: Do not copy Kotlin, Swift, Objective-C++, or C++ files. Flutter plugin registration and required native dependencies are handled by myhub_live_sdk.
4. iOS permissions and CocoaPods
The main Flutter application owns the iOS Runner target, so its Podfile and Info.plist must contain the media permission configuration.
Final ios/Podfile
platform :ios, '13.0'
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(
File.join('..', 'Flutter', 'Generated.xcconfig'),
__FILE__
)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. Run flutter pub get first."
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}"
end
require File.expand_path(
File.join('packages', 'flutter_tools', 'bin', 'podhelper'),
flutter_root
)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
'PERMISSION_CAMERA=1',
'PERMISSION_MICROPHONE=1',
]
end
end
end
ios/Runner/Info.plist
Add these entries inside the main <dict>:
<key>NSCameraUsageDescription</key>
<string>Camera access is required for video calls.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone access is required for audio and video calls.</string>
No additional SDK pod is required. Keep the Podfile changes limited to the iOS platform version and camera/microphone permission definitions shown below.
5. Call flow and callId handling
Create CallSDK and register CallEventListenerNew.
Connect the current user with connect(userId: ...).
Start an outgoing audio or video call using startCall.
The signaling server returns call_ringing. The SDK calls onCallRinging(callId) on the caller.
The receiver gets the same ID in onIncomingCall(callId, fromUserId, isVideo).
Both users pass that exact callId to the SDK's roomId parameter.
The caller starts media after onCallAccepted(); the receiver starts media while accepting.
No separate room value is required. Do not hardcode a room name and do not ask the user to enter one. Pass the received callId to the SDK's roomId parameter.
Use isVideo: true for video calls and isVideo: false for audio-only calls. The receiver must use the value received in onIncomingCall.
6. SDK methods used by CallTestScreen
Method
Purpose
connect
Registers the current user with MyHub signaling.
startCall
Starts an outgoing audio or video call.
acceptCall
Accepts an incoming call and starts the SDK media session.
rejectCall
Rejects the incoming call.
endCall
Ends an outgoing, ringing, connecting, or connected call.
startMedia
Starts caller media after the call is accepted.
muteAudio
Mutes or unmutes the local microphone.
muteVideo
Enables or disables the local camera.
switchCamera
Switches between available cameras.
7. Listener callbacks
Callback
Screen behavior
onCallRinging(callId)
Server confirmed ringing. Store the call ID and pass it to the SDK when media starts.
onIncomingCall(callId, fromUserId, isVideo)
Incoming call details for the receiver.
onCallAccepted()
Caller starts media using the stored callId.
onCallRejected()
Clear call state and show rejected status.
onCallEnded()
Clear media and call state.
onUserOffline()
Target user is not connected.
onLocalAudioMuted
Updates the local microphone UI.
onLocalVideoMuted
Updates the local camera UI.
onRemoteAudioMuted
Updates remote microphone status.
onRemoteVideoMuted
Shows remote profile UI when camera is off.
Status UI: The screen shows OFFLINE, READY, CALLING, RINGING, INCOMING, CONNECTING, CONNECTED, REJECTED, ENDED, USER OFFLINE, PERMISSION, and ERROR states.
8. Complete CallTestScreen
Create lib/call_test_screen.dart and use the following tested screen. It supports incoming/outgoing audio and video calls, caller cancellation while ringing, media permissions, mute controls, camera switching, remote mute states, and call status UI.