I am trying to play a MOV file in Android app made with flutter. I checked Exoplayer it doesn’t support MOV files. Any idea on how this can be handled? Suppose we are building a gallery app and we want to open MOV files it should be possible.
Sample code
import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';
void main() => runApp(const VideoApp());
/// Stateful widget to fetch and then display video content.
class VideoApp extends StatefulWidget {
const VideoApp({super.key});
@override
_VideoAppState createState() => _VideoAppState();
}
class _VideoAppState extends State<VideoApp> {
late VideoPlayerController _controller;
@override
void initState() {
super.initState();
_controller = VideoPlayerController.networkUrl(Uri.parse(
'https://filesamples.com/samples/video/mov/sample_1280x720_surfing_with_audio.mov'))
..initialize().then((_) {
// Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
setState(() {});
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Video Demo',
home: Scaffold(
body: Center(
child: _controller.value.isInitialized
? AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: VideoPlayer(_controller),
)
: Container(),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
setState(() {
_controller.value.isPlaying
? _controller.pause()
: _controller.play();
});
},
child: Icon(
_controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
),
),
),
);
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
}
Connected to the VM Service.
I/PlatformViewsController(27742): Hosting view in view hierarchy for platform view: 0
I/PlatformViewsController(27742): PlatformView is using SurfaceProducer backend
E/FrameEvents(27742): updateAcquireFence: Did not find frame.
W/Parcel (27742): Expecting binder but got null!
E/FrameEvents(27742): updateAcquireFence: Did not find frame.
2
W/Parcel (27742): Expecting binder but got null!
D/nativeloader(27742): Load /data/app/~~hJLU8a2e10BTHJzPO5r1dg==/com.example.video_player_mov-S41yx1OV0jBptPlgLkmuxg==/lib/arm64/libc++_shared.so using ns clns-6 from class loader (caller=/data/app/~~hJLU8a2e10BTHJzPO5r1dg==/com.example.video_player_mov-S41yx1OV0jBptPlgLkmuxg==/base.apk): ok
D/nativeloader(27742): Load /data/app/~~hJLU8a2e10BTHJzPO5r1dg==/com.example.video_player_mov-S41yx1OV0jBptPlgLkmuxg==/lib/arm64/libvlc.so using ns clns-6 from class loader (caller=/data/app/~~hJLU8a2e10BTHJzPO5r1dg==/com.example.video_player_mov-S41yx1OV0jBptPlgLkmuxg==/base.apk): ok
D/nativeloader(27742): Load /data/app/~~hJLU8a2e10BTHJzPO5r1dg==/com.example.video_player_mov-S41yx1OV0jBptPlgLkmuxg==/lib/arm64/libvlcjni.so using ns clns-6 from class loader (caller=/data/app/~~hJLU8a2e10BTHJzPO5r1dg==/com.example.video_player_mov-S41yx1OV0jBptPlgLkmuxg==/base.apk): ok
D/DecorView(27742): isCts, pkg: com.example.video_player_mov
E/FrameEvents(27742): updateAcquireFence: Did not find frame.
D/DecorView(27742): isCts, pkg: com.example.video_player_mov
D/ProfileInstaller(27742): Installing profile for com.example.video_player_mov
Application finished.
Exited.
Using contents of this forum for the purposes of training proprietary AI models is forbidden. Only if your AI model is free & open source, go ahead and scrape. Flutter and the related logo are trademarks of Google LLC. We are not endorsed by or affiliated with Google LLC.