polyv_live_scenes 0.0.1
polyv_live_scenes: ^0.0.1 copied to clipboard
Polyv Live Scenes Flutter plugin for opening native live watching rooms on Android and iOS.
Polyv Live Scenes #
polyv_live_scenes is the official Flutter plugin for opening Polyv native live watching rooms on Android and iOS.
中文客户集成说明:客户集成文档
Requirements #
| Platform | Requirement |
|---|---|
| Flutter | 3.41.0 or later |
| Dart | 3.11.0 or later |
| Android | API 24+, compile SDK 36, Java 17 |
| iOS | iOS 13.0+ and CocoaPods |
This package uses private Polyv native repositories. Obtain repository credentials and live account parameters from Polyv before integrating the plugin.
Installation #
Add the dependency to your application's pubspec.yaml:
dependencies:
polyv_live_scenes: ^0.0.1
Then run:
flutter pub get
Private Android Repository #
Add the credentials supplied by Polyv to ~/.gradle/gradle.properties. Do not commit this file:
polyvMavenUsername=your_polyv_maven_username
polyvMavenPassword=your_polyv_maven_password
CI can provide the same values through environment variables:
POLYV_MAVEN_USERNAME
POLYV_MAVEN_PASSWORD
The plugin already declares the required repository URLs. Builds without valid credentials fail while resolving the Polyv Android SDK.
iOS Setup #
Set the deployment target in ios/Podfile:
platform :ios, '13.0'
Add the permission descriptions required by the features enabled in your application:
<key>NSCameraUsageDescription</key>
<string>Camera access is used for live interaction.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone access is used for live interaction.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Photo library access is used to select images.</string>
Install pods after changing dependencies:
cd ios
pod install --repo-update
Usage #
import 'package:flutter/services.dart';
import 'package:polyv_live_scenes/polyv_live_scenes.dart';
final liveScenes = PolyvLiveScenes();
Future<void> openLiveRoom() async {
try {
final result = await liveScenes.loginLiveRoom(
channelType: 0,
channelId: 'your_channel_id',
userId: 'your_user_id',
appId: 'your_app_id',
appSecret: 'your_app_secret',
viewerName: 'Viewer',
viewerAvatar: 'https://example.com/avatar.png',
);
if (result['success'] == true) {
// The native live room is open.
}
} on PlatformException catch (error) {
// Handle error.code and error.message in your application.
}
}
channelType is reserved for future scene selection. Pass 0 in version 0.0.1; the native SDK determines the actual live channel type.
Parameters #
| Parameter | Required | Description |
|---|---|---|
channelType |
Yes | Reserved. Pass 0 in version 0.0.1. |
channelId |
Yes | Polyv live channel ID. |
userId |
Yes | Polyv account user ID and default viewer ID. |
appId |
Yes | Polyv application ID. |
appSecret |
Yes | Polyv application secret. Never commit a production value. |
viewerName |
No | Display name. Defaults to userId. |
viewerAvatar |
No | Avatar URL. Defaults to the native SDK value. |
Error Codes #
| Code | Platform | Meaning |
|---|---|---|
INVALID_ARGUMENTS |
Android, iOS | One or more required arguments are missing. |
NO_ACTIVITY |
Android | The Flutter engine is not attached to an Activity. |
INIT_FAILED |
Android | Native SDK or dependency initialization failed. |
LOGIN_FAILED |
Android, iOS | Account or channel login failed. |
UNSUPPORTED_CHANNEL_TYPE |
Android | The detected channel type is not supported. |
LAUNCH_FAILED |
Android | The native room could not be opened. |
Security #
appSecret is sensitive. For production applications, obtain authorization through a trusted backend or another short-lived credential flow whenever the Polyv account configuration supports it. Never publish real account values in source code, logs, screenshots, or issue reports.
License #
This Flutter plugin is available under the MIT License. Polyv native SDK access and service use remain subject to the applicable Polyv commercial terms.