Closed expertdevs closed 4 years ago
Hi, theoretically it should be, as it is an independent widget that can be integrated anywhere, but it still needs to be tested in such cases. Do let me know if it works for you or not and I will be available to improve it if there is an issue.
Regarding further support of video controllers and orientation functionality, please give me time, I work on these over the weekends only, but I will try to check it out during the week as well. In the meantime, if you want to contribute, please feel free to open a PR and I will review that.
Thank you for your comment.
I tried to integrate it independently and it worked 1st time but 2nd time when i played my video app crashed with any logs.
Can you share the logs or the PR, so that I can review and fix it? It will be difficult to fix without reproducing.
I tried with xCode and got this
Fatal error: Unexpectedly found nil while unwrapping an Optional value: file /path/flutter_sdk/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_to_airplay-1.0.2/ios/Classes/FlutterAVPlayer.swift, line 26
Line 26: let filePath = arguments["file"] as! String
Okay, let me fix it. Can you share the widget code as well? how you are creating FlutterAVPlayer widget.
I used flick_video_player because I need to play video in landscape mode
I just pushed a fix to the master branch. I will submit a new version to pub.dev in a few minutes.
Any update on above? As I am still facing the same issue.
Fatal error: Unexpectedly found nil while unwrapping an Optional value
I have found a workaround but you can find a proper solution to it, I was going through the code and using breakpoints realized that the first time I build AirPlayRoutePickerView() Widget it builds it properly and when I try to build it second time it was trying to build FlutterAVPlayer() Widget instead and it was null so the app was crashing. So in the below file you see if viewId == 1 it build the AirPlayRoutePickerView() else it would build FlutterAVPlayer() Widget and when I try to load the page second time the viewId is incremented, for now I have changed it to if viewId >= 1 and it works for my purpose but you can implement a proper fix for it.
Thank you Jigar Kotak
// // SharePlatformViewFactory.swift // flutter_to_airplay // // Created by Junaid Rehmat on 22/08/2020. // import Foundation import Flutter
class SharePlatformViewFactory: NSObject, FlutterPlatformViewFactory { var _messenger : FlutterBinaryMessenger
init(messenger: FlutterBinaryMessenger & NSObjectProtocol) {
_messenger = messenger
}
func create(withFrame frame: CGRect, viewIdentifier viewId: Int64, arguments args: Any?) -> FlutterPlatformView {
if viewId == 1 {
let pickerView = FlutterRoutePickerView(frame: frame, viewIdentifier: viewId, arguments: args as! Dictionary<String, Any>, binaryMessenger: _messenger)
return pickerView
}
else
{
let pickerView = FlutterAVPlayer(frame: frame, viewIdentifier: viewId, arguments: args as! Dictionary<String, Any>, binaryMessenger: _messenger)
return pickerView
}
}
func createArgsCodec() -> FlutterMessageCodec & NSObjectProtocol {
return FlutterStandardMessageCodec.sharedInstance()
}
}
Thank you @expertdevs and @JigarKotak7. I have published version 1.0.4 and that will fix all of the crash issues. Please feel free to comment if you notice any further crashes. I will try to be more responsive now.
Hello, Thanks to make this plugin I really need this. But I want to know Is it possible to use AirPlayRoutePickerView() with other video player (like flick_video_player) or if possible please add video controllers and screen orientation functionality.