Closed roip890 closed 2 years ago
No, it works on the desktop only.
we need this on mobile also
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution.
Does the flutter SDK support screen sharing functionality on mobile apps (Android and iOS)?
I am getting this error, agora_rtc_engine: ^5.3.0
[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: PlatformException(ErrorCode.NotSupported, null, null, null)
#0 RtcEngineImpl.getScreenShareHelper (package:agora_rtc_engine/src/impl/rtc_engine_impl.dart:68:7)
Yes now the agora SDK support screen sharing in the flutter mobile app:
https://docs.agora.io/en/video-calling/develop/product-workflow?platform=flutter
I implemented its working in Android, But not in iOS there must be I'm missing some configuration Unfortunately they don't mention any configuration for the flutter iOS app.
However I followed the instruction from here, https://docs.agora.io/en/video-calling/develop/product-workflow?platform=ios#handle-the-system-logic
But still unable to share screen from flutter iOS app
Yes now the agora SDK support screen sharing in the flutter mobile app:
https://docs.agora.io/en/video-calling/develop/product-workflow?platform=flutter
I implemented its working in Android, But not in iOS there must be I'm missing some configuration Unfortunately they don't mention any configuration for the flutter iOS app. However I followed the instruction from here,
https://docs.agora.io/en/video-calling/develop/product-workflow?platform=ios#handle-the-system-logic
But still unable to share screen from flutter iOS app
i'm also facing same issue for flutter iOS app, yet not figure out the solution.
@devsideal @tejbhan177 Maybe you can check our Chinese doc for reference. https://docs.agora.io/cn/video-call-4.x/screensharing_flutter_ng?platform=Flutter
Thanks, @littleGnAl, I have followed all the steps given on that link, But now getting this exception when trying to share screen:
Unhandled Exception: MissingPluginException(No implementation found for method showRPSystemBroadcastPickerView on channel example_screensharing_ios)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:294:7)
<asynchronous suspension>
#1 _State._showRPSystemBroadcastPickerViewIfNeed (package:flutter_gm10/ui/liveStream/widget/live_stream_widget.dart:498:5)
<asynchronous suspension>
Probably this is due to:
Future<void> _showRPSystemBroadcastPickerViewIfNeed() async {
if (defaultTargetPlatform != TargetPlatform.iOS) {
return;
}
await _iosScreenShareChannel
.invokeMethod('showRPSystemBroadcastPickerView');
}
I'm referring to this sample: https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/blob/main/example/lib/examples/advanced/screen_sharing/screen_sharing.dart
After some research, I found to provide an implementation for showRPSystemBroadcastPickerView we need to write some code in the iOS AppDelegate class, like this https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/blob/main/example/ios/Runner/AppDelegate.m
But my iOS module is in swift So I converted it to swift, Now my AppDelegate.swift
looks like this:
import UIKit
import Flutter
import ReplayKit
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
var controller = window.rootViewController as? FlutterViewController
var screensharingIOSChannel = FlutterMethodChannel(
name: "example_screensharing_ios",
binaryMessenger: controller as! FlutterBinaryMessenger)
screensharingIOSChannel.setMethodCallHandler({
(call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
if #available(iOS 12.0, *) {
DispatchQueue.main.async(execute: {
if let url = Bundle.main.url(forResource: nil, withExtension: "appex", subdirectory: "PlugIns") {
if let bundle = Bundle(url: url) {
let picker = RPSystemBroadcastPickerView(frame: CGRect(x: 0, y: 0, width: 100, height: 200))
picker.showsMicrophoneButton = true
picker.preferredExtension = bundle.bundleIdentifier
for view in picker.subviews() {
if view is UIButton {
(view as? UIButton)?.sendActions(for: .allTouchEvents)
}
}
}
}
})
}
})
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
When I run the app getting this error:
Swift Compiler Error (Xcode): Cannot call value of non-function type '[UIView]'
/Users/macbook/FlutterProjects/flutter_gm10/ios/Runner/AppDelegate.swift:25:47
Does anyone know, What I'm doing wrong?
@devsideal I believe the subviews
should be a property.
https://developer.apple.com/documentation/uikit/uiview/1622614-subviews
@devsideal I believe the
subviews
should be a property. https://developer.apple.com/documentation/uikit/uiview/1622614-subviews
Yes changing subviews
as a property solved my syntax issue and now I can run the app, Checking for the screen sharing flow. Thanks.
Hi @littleGnAl Finally, I got this alert that I was expecting for the iOS,
I selected my created broadcast extension from the list and clicked on "Start Broadcast" button the indicator turns into the Red, which looks like the extension started screen capturing,
But the screen is not showing to the users joined in the same channel.
Apart from this setup, should I need to do something else? like should I need to write any script in SampleHandler.swift of my extension?
Now my SampleHandler.swift
is:
import ReplayKit
class SampleHandler: RPBroadcastSampleHandler {
override func broadcastStarted(withSetupInfo setupInfo: [String : NSObject]?) {
// User has requested to start the broadcast. Setup info from the UI extension can be supplied but optional.
}
override func broadcastPaused() {
// User has requested to pause the broadcast. Samples will stop being delivered.
}
override func broadcastResumed() {
// User has requested to resume the broadcast. Samples delivery will resume.
}
override func broadcastFinished() {
// User has requested to finish the broadcast.
}
override func processSampleBuffer(_ sampleBuffer: CMSampleBuffer, with sampleBufferType: RPSampleBufferType) {
switch sampleBufferType {
case RPSampleBufferType.video:
// Handle video sample buffer
break
case RPSampleBufferType.audioApp:
// Handle audio sample buffer for app audio
break
case RPSampleBufferType.audioMic:
// Handle audio sample buffer for mic audio
break
@unknown default:
// Handle other sample buffer types
fatalError("Unknown type of sample buffer")
}
}
}
@devsideal Can you raise a new issue for your problem, thanks.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please raise a new issue.
Hi,
Does the flutter SDK support screen sharing functionality on mobile apps (Android and iOS)? I am referring to this: https://docs.agora.io/en/Video/API%20Reference/flutter/v5.0.0/API/rtc_api_overview.html
Thanks