video_player_extra

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

video player extra

Video Player Extra plugin for Flutter #

A fork of flutter's video_player with extra ability to play 180 or 360 videos.
This plugin maintains same interface with the original package excepts:

Add mediaFormat in VideoPlayerOption
Add setMediaFormat in VideoPlayerController
Add setCameraRotation in VideoPlayerController

Ideally, this plugin can be used as drop-in replacement for video_player package.

Camera control #
Just pass roll pitch yaw (in degree) to setCameraRotation method. Please see full example here
Example #
import 'package:video_player_extra/video_player.dart';
import 'package:flutter/material.dart';

void main() => runApp(VideoApp());

class VideoApp extends StatefulWidget {
@override
_VideoAppState createState() => _VideoAppState();
}

class _VideoAppState extends State<VideoApp> {
VideoPlayerController _controller;

@override
void initState() {
super.initState();
_controller = VideoPlayerController.network(
'https://videojs-vr.netlify.app/samples/eagle-360.mp4',
videoPlayerOptions: VideoPlayerOptions(
mixWithOthers: true,
mediaFormat: MediaFormat.VR2D360,
),
)..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() {
super.dispose();
_controller.dispose();
}
}
copied to clipboard
More information #
Please read the original README.
Credits #
This package contains some code from Android AOSP project & Google VR SDK

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files:

Customer Reviews

There are no reviews.