polyv_live_scenes 0.0.3 copy "polyv_live_scenes: ^0.0.3" to clipboard
polyv_live_scenes: ^0.0.3 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.2

Then run:

flutter pub get

Private Android Repository #

Add the credentials supplied by Polyv to ~/.gradle/gradle.properties. Do not commit this file:

android.useAndroidX=true
android.enableJetifier=true
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. Jetifier is required because the current private Polyv native SDK still contains legacy Android support references. Builds without Jetifier or valid credentials fail while resolving or compiling the Android SDK.

The native dependency graph also contains legacy library manifests that define an application label. Update your app manifest to keep the host app label authoritative:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">
    <application
        android:label="your_app_name"
        tools:replace="android:label">
        <!-- Existing application content. -->
    </application>
</manifest>

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; the native SDK determines the actual live channel type.

Parameters #

Parameter Required Description
channelType Yes Reserved. Pass 0.
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.

0
likes
150
points
95
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Polyv Live Scenes Flutter plugin for opening native live watching rooms on Android and iOS.

Homepage

Topics

#polyv #live-streaming #video #flutter-plugin

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on polyv_live_scenes

Packages that implement polyv_live_scenes