< Headless Flutter SDK />
UTD Stream SDK
Flutter-এর জন্য headless LiveKit অডিও/ভিডিও সেশন — UI আপনি বানাবেন।
final client = UTDStreamClient(
appId: '1234567890',
appKey: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6',
);
// Audio room
final room = await client.joinAudioRoom(
identity: 'u1', roomName: 'lobby', asHost: true, seatCount: 8,
);
await room.takeSeat(0);
// Live stream
final live = await client.joinLiveStream(
identity: 'host1', roomName: 'show', asHost: true,
);
await live.goLive();
// 1:1 call
await client.authenticate(identity: 'u1');
final call = client.callSession(UTDStreamType.videoCall);
await call.start(calleeIdentity: 'u2');4
সেশন টাইপ
Headless
শূন্য UI
7
প্ল্যাটফর্ম
LiveKit
ইঞ্জিন
< utd_stream_sdk />
মূল বৈশিষ্ট্য
ইঞ্জিন হিসেবে LiveKit ব্যবহার করে Flutter-এ অডিও/ভিডিও অ্যাপ তৈরির একটি headless SDK। এটি চারটি সেশন টাইপ (অডিও কল, ভিডিও কল, লাইভ স্ট্রিম, অডিও রুম) শুধু-লজিক সেশন হিসেবে উন্মুক্ত করে এবং ValueListenables ও একটি র RoomEvent স্ট্রিমের মাধ্যমে স্টেট প্রকাশ করে। পুরো UI আপনার নিয়ন্ত্রণে; SDK সেশন, সার্ভার-অনুমোদিত পারমিশন এবং মিডিয়া কন্ট্রোল সামলায় — অ্যাপে কোনো সিক্রেট না পাঠিয়েই।
চারটি সেশন টাইপ: অডিও কল, ভিডিও কল, লাইভ স্ট্রিম, অডিও রুম
ডিজাইন থেকেই headless — বিশুদ্ধ লজিক ও স্টেট, শূন্য UI
LiveKit ইন্টিগ্রেশন, ডিফল্টে অ্যাডাপটিভ স্ট্রিমিং ও dynacast চালু
ValueListenables-এর মাধ্যমে রিঅ্যাকটিভ স্টেট এবং সাথে একটি র RoomEvent স্ট্রিম
সার্ভার-অনুমোদিত পারমিশন (সিট/স্টেজ প্রমোশন ইঞ্জিন দ্বারা নিয়ন্ত্রিত)
সীমাহীন কো-পাবলিশার সহ লাইভ-স্ট্রিম স্টেজ ম্যানেজমেন্ট
অডিও রুমের জন্য সিট-ভিত্তিক স্পিকার/শ্রোতা মডেল
1:1 কল লাইফসাইকল স্টেট মেশিন
অ্যাপে কোনো সিক্রেট ছাড়াই টাইপড REST ফ্যাসাড
< utd_stream_sdk />
শুরু করুন
ইনস্টল করুন
flutter pub add utd_stream_sdk< utd_stream_sdk />
API রেফারেন্স
Client & entry point
Top-level entry point that holds credentials and produces logic-only sessions for each product type.
UTDStreamClientconstructorfactory UTDStreamClient({required String appId, required String appKey, String baseUrl, String tokenBaseUrl})Builds a headless client from publishable credentials (appId + appKey). One instance per signed-in user; shares a single HTTP layer across all sessions.
প্যারামিটার
appIdStringআবশ্যকPublishable app id for the project.
appKeyStringআবশ্যকPublishable app key paired with appId.
baseUrlStringডিফল্ট = UTDApiClient.defaultBaseUrlEngine REST base URL.
tokenBaseUrlStringডিফল্ট = UTDApiClient.defaultTokenBaseUrlToken-minting service base URL.
identitygetterString? get identityThe identity of the currently authenticated / joined user, or null if none.
রিটার্ন: String? — Current user identity or null.
authenticatemethodasyncFuture<String> authenticate({required String identity, String? name, String? deviceId})Mints a room-less per-user bearer and attaches it for privileged calls. Required before starting/accepting 1:1 calls. Returns the user_token.
প্যারামিটার
identityStringআবশ্যকUnique user identity to mint the bearer for.
nameString?Optional display name.
deviceIdString?Optional device identifier.
রিটার্ন: Future<String> — The minted user_token bearer.
callSessionmethodUTDCallSession callSession(UTDStreamType type)Creates a 1:1 call session (audio or video). Call authenticate() first. Asserts the type is a call type.
প্যারামিটার
typeUTDStreamTypeআবশ্যকMust be audioCall or videoCall.
রিটার্ন: UTDCallSession — A new call session driven by start()/accept().
joinLiveStreammethodasyncFuture<UTDLiveStreamSession> joinLiveStream({required String identity, required String roomName, bool asHost, String? name, String? deviceId})Mints a room token, connects the media room, and returns a live stream session. Host publishes via goLive(); viewers subscribe and may requestStage().
প্যারামিটার
identityStringআবশ্যকJoining user identity.
roomNameStringআবশ্যকRoom to join (un-prefixed name).
asHostboolডিফল্ট = falseJoin as host (role=host, owns the room) vs audience.
nameString?Optional display name.
deviceIdString?Optional device identifier.
রিটার্ন: Future<UTDLiveStreamSession> — A connected live stream session.
joinAudioRoommethodasyncFuture<UTDAudioRoomSession> joinAudioRoom({required String identity, required String roomName, bool asHost, String? name, String? deviceId, int? seatCount, String? seatMode})Mints a room token, connects, and returns a seat-based audio room session. Host may seed the seat grid via seatCount/seatMode.
প্যারামিটার
identityStringআবশ্যকJoining user identity.
roomNameStringআবশ্যকRoom to join (un-prefixed name).
asHostboolডিফল্ট = falseJoin as host vs audience; only hosts may seed seats.
nameString?Optional display name.
deviceIdString?Optional device identifier.
seatCountint?Host only: number of seats to seed the grid with.
seatModeString?Host only: seat mode (e.g. free/request).
রিটার্ন: Future<UTDAudioRoomSession> — A connected audio room session.
disposemethodvoid dispose()Releases the underlying HTTP pools. Sessions must be disposed separately.
রিটার্ন: void — Nothing.
Session base & headless state
Shared base class re-exposing the LiveKit room state as ValueListenables and a raw event stream.
UTDSessionclassabstract class UTDSessionAbstract base for every session type. Owns the UTDRoom and re-exposes its headless state; concrete sessions add per-type control (call lifecycle, stage, seats).
typepropertyfinal UTDStreamType typeThe product type of this session (audioCall, videoCall, liveStream, audioRoom).
রিটার্ন: UTDStreamType — The session product type.
roompropertyfinal UTDRoom roomThe headless UTDRoom wrapper owning the LiveKit connection lifecycle.
রিটার্ন: UTDRoom — The underlying room wrapper.
connectedgetterValueListenable<bool> get connectedListenable that reflects whether the media room is currently connected.
রিটার্ন: ValueListenable<bool> — Connection state.
canPublishgetterValueListenable<bool> get canPublishListenable for whether the server has granted this participant publish capability (seat/stage authoritative).
রিটার্ন: ValueListenable<bool> — Publish capability state.
remoteParticipantsgetterValueListenable<List<RemoteParticipant>> get remoteParticipantsListenable list of remote participants, refreshed on connect/disconnect and track subscription events.
রিটার্ন: ValueListenable<List<RemoteParticipant>> — Current remote participants.
eventsgetterasyncStream<RoomEvent> get eventsRaw broadcast stream of LiveKit RoomEvents for apps that want the full firehose (track subscribed, data, metadata, speakers).
রিটার্ন: Stream<RoomEvent> — Broadcast LiveKit event stream.
localParticipantgetterLocalParticipant? get localParticipantThe local LiveKit participant, or null before connection.
রিটার্ন: LocalParticipant? — Local participant or null.
setMicrophonemethodasyncFuture<void> setMicrophone(bool enabled)Toggles the local mic. Refused by the SFU unless the server has granted publish.
প্যারামিটার
enabledboolআবশ্যকWhether to enable the microphone.
রিটার্ন: Future<void> — Completes when applied.
sendDatamethodasyncFuture<void> sendData(List<int> data, {bool reliable = true, List<String>? to})Sends a data message (chat/gifts/custom signalling) to the room, optionally to specific identities.
প্যারামিটার
dataList<int>আবশ্যকRaw bytes payload.
reliableboolডিফল্ট = trueUse reliable delivery.
toList<String>?Target participant identities; null broadcasts to all.
রিটার্ন: Future<void> — Completes when sent.
leavemethodasyncFuture<void> leave()Leaves the media room but keeps the session object reusable.
রিটার্ন: Future<void> — Completes after disconnect.
disposemethodasyncFuture<void> dispose()Tears down the session and its LiveKit room.
রিটার্ন: Future<void> — Completes after teardown.
Call session (1:1)
1:1 audio/video call lifecycle. Caller starts, callee accepts; room capped at 2 by the engine.
UTDCallSessionclassclass UTDCallSession extends UTDSession1:1 call session (audio_call or video_call). Both parties publish. Caller start()s; callee accept()s an incoming call by id.
statuspropertyfinal ValueNotifier<UTDCallStatus?> statusListenable for the current call lifecycle status, null until a call starts.
রিটার্ন: ValueNotifier<UTDCallStatus?> — Current call status.
callIdpropertyfinal ValueNotifier<String?> callIdListenable for the active engine call id, null until a call starts/accepts.
রিটার্ন: ValueNotifier<String?> — Active call id.
startmethodasyncFuture<UTDCall> start({required String calleeIdentity, String? calleeName, Map<String, dynamic>? metadata})Caller side: creates the call, rings the callee, joins the call room and publishes. Returns the engine call.
প্যারামিটার
calleeIdentityStringআবশ্যকIdentity of the user being called.
calleeNameString?Optional callee display name.
metadataMap<String, dynamic>?Optional call metadata.
রিটার্ন: Future<UTDCall> — The created engine call.
acceptmethodasyncFuture<UTDCall> accept(String id)Callee side: accepts an incoming call by id and joins the call room, publishing mic (and camera for video).
প্যারামিটার
idStringআবশ্যকThe incoming call id (arrives out-of-band).
রিটার্ন: Future<UTDCall> — The accepted engine call.
ringingmethodasyncFuture<void> ringing(String id)Marks the call as ringing on the engine and updates status.
প্যারামিটার
idStringআবশ্যকThe call id.
রিটার্ন: Future<void> — Completes when status updated.
rejectmethodasyncFuture<void> reject(String id)Rejects an incoming call and updates status.
প্যারামিটার
idStringআবশ্যকThe call id to reject.
রিটার্ন: Future<void> — Completes when rejected.
busymethodasyncFuture<void> busy(String id)Marks the callee as busy for the given call and updates status.
প্যারামিটার
idStringআবশ্যকThe call id.
রিটার্ন: Future<void> — Completes when marked busy.
endmethodasyncFuture<void> end()Hangs up the active call, ending it server-side and disconnecting the media room. Tolerant of terminal/duplicate ends.
রিটার্ন: Future<void> — Completes after teardown.
Live stream session & stage control
One host + unlimited viewers; host promotes any number of viewers to co-publish (no engine cap).
UTDLiveStreamSessionclassclass UTDLiveStreamSession extends UTDSessionLive stream session: one host publishes A/V, unlimited viewers subscribe, host can promote any number of co-publishers. Stage promotion is server-authoritative.
roomNamepropertyfinal String roomNameThe (un-prefixed) live stream room name.
রিটার্ন: String — Room name.
isHostpropertyfinal bool isHostWhether this participant joined as the host.
রিটার্ন: bool — Host flag.
stagepropertyfinal ValueNotifier<List<UTDStageMember>> stageListenable list of current stage members (host + co-publishers), refreshed via refreshStage() or stage events.
রিটার্ন: ValueNotifier<List<UTDStageMember>> — Current stage members.
goLivemethodasyncFuture<void> goLive({bool withVideo = true})Host: begins broadcasting by publishing mic and (optionally) camera. Viewers never call this.
প্যারামিটার
withVideoboolডিফল্ট = truePublish camera in addition to mic.
রিটার্ন: Future<void> — Completes when broadcasting.
refreshStagemethodasyncFuture<void> refreshStage()Fetches the current stage roster from the engine and updates the stage listenable.
রিটার্ন: Future<void> — Completes when stage refreshed.
inviteToStagemethodasyncFuture<void> inviteToStage(String identity)Host/admin: promotes a viewer to co-publish (audio+video). Unbounded.
প্যারামিটার
identityStringআবশ্যকViewer identity to promote.
রিটার্ন: Future<void> — Completes after promotion and stage refresh.
removeFromStagemethodasyncFuture<void> removeFromStage(String identity)Host/admin: removes a co-publisher back to viewer.
প্যারামিটার
identityStringআবশ্যকCo-publisher identity to demote.
রিটার্ন: Future<void> — Completes after demotion and stage refresh.
requestStagemethodasyncFuture<void> requestStage()Viewer: raises a hand to be promoted, notifying the host.
রিটার্ন: Future<void> — Completes when request sent.
leaveStagemethodasyncFuture<void> leaveStage()Co-publisher: steps down to a viewer, stopping camera and mic.
রিটার্ন: Future<void> — Completes after stepping down.
Audio room session & seat control
Seat-based speakers + listeners; taking a seat is what grants publish. Audio-only by design.
UTDAudioRoomSessionclassclass UTDAudioRoomSession extends UTDSessionAudio room session: speakers occupy seats and publish mic, listeners subscribe. Publishing is seat occupancy, not a token role. Audio-only.
roomNamepropertyfinal String roomNameThe (un-prefixed) audio room name.
রিটার্ন: String — Room name.
isHostpropertyfinal bool isHostWhether this participant joined as the host.
রিটার্ন: bool — Host flag.
setupSeatsmethodasyncFuture<Map<String, dynamic>> setupSeats({int? seatCount, String? seatMode, String? modeId})Host: configures the seat grid (count + free/request mode). Usually passed at join instead. Returns the raw engine response.
প্যারামিটার
seatCountint?Number of seats.
seatModeString?Seat mode (e.g. free/request).
modeIdString?Optional mode identifier.
রিটার্ন: Future<Map<String, dynamic>> — Raw engine seat-setup response.
getSeatsmethodasyncFuture<Map<String, dynamic>> getSeats()Fetches the current seat grid state from the engine.
রিটার্ন: Future<Map<String, dynamic>> — Raw engine seats state.
takeSeatmethodasyncFuture<void> takeSeat(int index)Takes a seat to become a speaker; the engine grants publish, then the mic is enabled locally.
প্যারামিটার
indexintআবশ্যকSeat index to occupy.
রিটার্ন: Future<void> — Completes when seated and mic on.
leaveSeatmethodasyncFuture<void> leaveSeat()Leaves the seat (back to listener); the engine revokes publish and the mic is disabled.
রিটার্ন: Future<void> — Completes when off-seat.
requestToSpeakmethodasyncFuture<void> requestToSpeak()Listener: requests to speak (in request mode); a host approves.
রিটার্ন: Future<void> — Completes when request sent.
approveSpeakermethodasyncFuture<void> approveSpeaker(int requestId)Host: approves a pending speak request by id.
প্যারামিটার
requestIdintআবশ্যকPending request id to approve.
রিটার্ন: Future<void> — Completes when approved.
inviteToSpeakmethodasyncFuture<void> inviteToSpeak(String identity, {int? seatIndex})Host: invites a listener to speak, optionally targeting a specific seat.
প্যারামিটার
identityStringআবশ্যকListener identity to invite.
seatIndexint?Optional target seat index.
রিটার্ন: Future<void> — Completes when invite sent.
Room wrapper & media
Headless wrapper around a LiveKit Room exposing connection state, media toggles, and the event stream.
UTDRoomconstructorUTDRoom({bool adaptiveStream = true, bool dynacast = true})Headless wrapper around a LiveKit Room. Owns the connection lifecycle and surfaces state as ValueListenables + a broadcast event stream. Never elevates its own permissions.
প্যারামিটার
adaptiveStreamboolডিফল্ট = trueEnable LiveKit adaptive stream.
dynacastboolডিফল্ট = trueEnable LiveKit dynacast.
roompropertyfinal Room roomThe underlying LiveKit Room instance.
রিটার্ন: Room — LiveKit room.
eventsgetterasyncStream<RoomEvent> get eventsRaw LiveKit room events for apps that want the full firehose (track subscribed, data, etc.).
রিটার্ন: Stream<RoomEvent> — Broadcast LiveKit event stream.
connectmethodasyncFuture<void> connect(String url, String token, {bool autoSubscribe = true})Connects to the LiveKit room with the given url and token, wires event listeners, and refreshes permissions/remotes.
প্যারামিটার
urlStringআবশ্যকLiveKit ws URL.
tokenStringআবশ্যকLiveKit JWT.
autoSubscribeboolডিফল্ট = trueAuto-subscribe to remote tracks.
রিটার্ন: Future<void> — Completes when connected.
setMicrophonemethodasyncFuture<void> setMicrophone(bool enabled)Enables/disables the local microphone. Refused by the SFU unless the server granted publish.
প্যারামিটার
enabledboolআবশ্যকWhether to enable the mic.
রিটার্ন: Future<void> — Completes when applied.
setCameramethodasyncFuture<void> setCamera(bool enabled)Enables/disables the local camera. Refused by the SFU unless the server granted publish.
প্যারামিটার
enabledboolআবশ্যকWhether to enable the camera.
রিটার্ন: Future<void> — Completes when applied.
sendDatamethodasyncFuture<void> sendData(List<int> data, {bool reliable = true, List<String>? destinationIdentities})Sends a data message to the room (chat/gifts/custom signalling), optionally to specific identities.
প্যারামিটার
dataList<int>আবশ্যকRaw bytes payload.
reliableboolডিফল্ট = trueUse reliable delivery.
destinationIdentitiesList<String>?Target identities; null broadcasts.
রিটার্ন: Future<void> — Completes when sent.
Models & enums
Data types and enums returned by the engine: stream types, call lifecycle, token responses, errors.
UTDStreamTypeenumenum UTDStreamType { audioCall, videoCall, liveStream, audioRoom }The four canonical product types (audioCall, videoCall, liveStream, audioRoom). Each carries a wire value and isCall/hasVideo helpers.
UTDCallStatusenumenum UTDCallStatus { initiating, ringing, active, ended, rejected, busy, missed }Lifecycle of a 1:1 call mirroring engine call states: initiating, ringing, active, ended, rejected, busy, missed.
UTDTokenResponseclassclass UTDTokenResponse { final String token; final String url; final String roomName; final String userToken; final String? wsUrl; }Response of a room token mint (POST /api/v1/token), carrying the LiveKit token+url, room name, engine bearer user_token, and optional wsUrl.
UTDCallclassclass UTDCall { final String callId; final UTDCallStatus status; final UTDStreamType type; ... }A 1:1 call as returned by the engine, carrying callId, status, type, and optional roomName/token/url/callee+caller identities.
UTDStageMemberclassclass UTDStageMember { final String identity; final String? name; final String? role; }A member of a live_stream stage (the unbounded publisher set), with identity and optional name/role.
UTDStreamExceptionclassclass UTDStreamException implements Exception { final String message; final int? statusCode; final String? code; }All SDK errors surface as this, carrying the engine HTTP statusCode + message + optional code; exposes isBanned (403) and isRateLimited (429).
UTD দিয়ে গড়তে প্রস্তুত?
আপনার অ্যাকাউন্ট তৈরি করুন, মাস্টার ওয়ালেট ফান্ড করুন, এবং প্রয়োজনীয় সার্ভিসগুলো চালু করুন।