There is this Flutter plugin for playing videos on iOS & Android (Video Plugin)
However, I also want to embed a video player into my web and desktop applications.
So I dont understand how Flutter is going this way of supporting plugins for different platforms. Because if you have a look at the video plugin it makes use of the AVPlayer on iOS and ExoPlayer on Android, but these are not then supported for web and desktop applications.
My Questions:
Why isn't the community writing a Flutter plugin for videos which is independent of it's underlying platform? Or isn't it possible? Why do we have to rely so much on Android & iOS especially if Flutter will be more and more platform independent in the future? Isn't it possible to write the source code for making videos working on different platforms solely with the Dart language & Flutter framework?
Is there currently a way to embed a video player for web and desktop applications?
You can use dart_vlc to add video playback to your Flutter desktop application.
It currently supports Windows & Linux, we are working on adding macOS support actively.
The library is rather easier to use aswell,
Player player = Player(id: 0);
player.open(
Playlist(
medias: [
Media.file(File('C:/music.mp3')),
Media.file(File('C:/audio.mp3')),
Media.network('https://www.example.com/music.aac'),
],
),
);
Thanks. Checkout project README for more examples and documentation.
You can try using WebView by flutter_webview_plugin package. It can take advantage of the built-in video decoders/players in any Operating Systems as they're pre-loaded as web content.
Edit: This is because not many Video Plugins are to be found for the Desktop and Web Platforms yet (At least by me)
The video_player along with the video_player_web plugins work for web, android and ios. But I have not tested them on a desktop.
Related
I want to integrate one to one video call feature to the Ionic3 project, it should support all platforms like WEB, Android, IOS. I tried so many APIs like VONAGE, PUBNUB-WebRtc, ZohoDesk, OpenTok, Enablex. But all libraries are supporting only mobile platforms through Ionic, those are not supporting on the web. Can anyone help to do this?
thankyou
When an external component such as a Camera or File picker is needed, the Flutter for Android Developers documentation (currently in the works) states that we would have to build a native platform integration.
I currently have a device that has a built-in barcode reader with a manufacturer-provided Android API. So, for that I would need to pursue this native platform integration method - or even for playing videos or using the camera for that matter I would think.
Is there an example repo that demonstrates how a well-integrated app should be? ..a project that integrated ExoPlayer for example?
You can use platform channels to call native APIs that aren't exposed by the Flutter platform.
There is an example in the Writing custom platform-specific code docs:
The full, runnable source-code for this example is available in /examples/platform_channel/ for Android with Java and iOS with Objective-C.
If you want to make your code reusable by others, you can publish it as a package, but this is optional. There is a repo of plugins maintained by the Flutter team that you can use for inspiration.
I've searched some times here but could't find an Answer to this.
Does someone know this and can explain how Ionic handles it?
Does Ionic compile the Code to Native? NO
Ionic is for developing Hybrid apps.
What are Hybrid apps?
Hybrid apps are essentially websites embedded in a mobile app through
what we call a webview. They are developed using HTML5, CSS, and
Javascript, and execute the same code regardless of the platform in
which they run. They can, with tools like PhoneGap and Cordova, use
the native features of a device, like GPS or camera.
What are Native apps?
Native apps are developed in the language required by the platform it
targets, Objective-C or Swift for iOS, Java for Android, etc. The code
written is not shared across platforms and their behavior varies. They
have direct access to all features offered by the platform without any
restriction.
Here is a nice article about it.
Cordova converts the project into a native which has only ONE Page, that is a WebView (WKV WEB View in iOS, etc). And all of the ionic code is run on that webview. Basically an ionic/cordova app is a website which looks like an app!
I have a problem with the audio that is not working on Android or an emulator. But it is working on web apps. I have searched in Google but i can't find the solution.
Why does cc.audioEngine is not working while using Intel XDK ?
Instead using library of JS, you can build your own plugin of cordova to record / play audio on your android. Or search existing cordova plugin on github.
It's not that the XDK is "not working" it's that the webview and/or webview requirements don't meet the requirements of your cc.audioEngine library. I'm no expert on cc.audioEngine, but it appears to require Web Audio. That is not supported in the standard webview that you find in the typical Android device. This is why we provide the Crosswalk for Android build option. It includes the modern HTML5 features and APIs you take for granted in your desktop browser.
Try building with Crosswalk and debugging with the Debug tab. Both of those use the Crosswalk webview.
Can't seem to find which rendering engine the mobile app wrapper Ionic uses. Is it Webkit?
Ionic's Cordova is essentially opening a webview from the native app. That means the rendering engine is different on every device. For example, on the latest devices, Android uses webkit, and iOS uses WkWebView. That's where you have to be careful. Some styling like css-animation behaves differently.
To add to the other answer:
If you wish to have the same experience across the platform, you could always resolve to using the crosswalk plugin. On android, it basically installs the webkit and uses it instead of the native webview, so that it will always display the same across devices. On iOS, there is a similar version for the iOS8 and up to use the new wkWebView and not the old uiwebview. Just google cordova crosswalk and it should come up.