vdocipher_flutter

Creator: coderz1093

Last updated:

0 purchases

vdocipher_flutter Image
vdocipher_flutter Images

Languages

Categories

Add to Cart

Description:

vdocipher flutter

VdoCipher plugin for flutter apps. #

This Flutter plugin package enables video playback functionality by seamlessly delegating to native libraries tailored for each platform.



Platform
Minimum Version




Android
API level 21


iOS
12


Web
Chrome, Firefox, Safari, Edge



Getting started #
Run this command with Flutter:
$ flutter pub add vdocipher_flutter
copied to clipboard
This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):
dependencies:
vdocipher_flutter: ^2.6.9
copied to clipboard
Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.
To import it in your Dart code now, you can use:
import 'package:vdocipher_flutter/vdocipher_flutter.dart';
copied to clipboard

Note
For SDK v2.2.0 and above, please use Theme.AppCompat theme with MainActivity.java and extend from FlutterFragmentActivity. For a better understanding, please take a look at our sample app.

Configuring VdoCipher Player #

//Creating embedInfo.
const EmbedInfo SAMPLE_1 = EmbedInfo.streaming(
otp: '20160313versASE323nOHtQDX5BrcPQRzuzglCjLxHbd1JkvBFvBcPF68ysWD8HN',
playbackInfo: 'eyJ2aWRlb0lkIjoiNWRlMDlmMGRjYmQ3NGI0NDljOWI1ZjRmYzBmMzI3ZmYifQ==',
embedInfoOptions: EmbedInfoOptions(
autoplay: true,
customPlayerId: "4OEwYIsGO64aBwRp"
)
);
copied to clipboard
class VdoPlaybackView extends StatefulWidget {

@override
_VdoPlaybackViewState createState() => _VdoPlaybackViewState();
}

class _VdoPlaybackViewState extends State<VdoPlaybackView> {
VdoPlayerController? _controller;
final double aspectRatio = 16/9;
ValueNotifier<bool> _isFullScreen = ValueNotifier(false);

@override
Widget build(BuildContext context) {
return Scaffold(
body: VdoPlayer(
embedInfo: embedInfo,
onPlayerCreated: (controller) => _onPlayerCreated(controller),
onFullscreenChange: (isFullscreen) {},
onError: (vdoError) {},
));
}

_onPlayerCreated(VdoPlayerController? controller) {
setState(() {
_controller = controller;
_onEventChange(_controller);
});
}

_onEventChange(VdoPlayerController? controller) {
controller!.addListener(() {
VdoPlayerValue value = controller.value;

print("VdoControllerListner"
"\nloading: ${value.isLoading} "
"\nplaying: ${value.isPlaying} "
"\nbuffering: ${value.isBuffering} "
"\nended: ${value.isEnded}"
);
});
}

double _getHeightForWidth(double width) {
return width / aspectRatio;
}
}
copied to clipboard
Playback Control Methods #
Play
Start or resume playing the video.
_controller?.play()
copied to clipboard
Pause
Pause video playback.
_controller?.pause()
copied to clipboard
Seek
Seek to the specified target position.
Duration target = Duration(seconds: 30);
_controller?.seek(target);
copied to clipboard
Total Played And Total Covered
Returns values of additional properties specific to current playback session.
Returned values need to be cast to their expected types before use.
int? totalPlayed = (await _controller?.getPlaybackProperty('totalPlayed')) as int?;
int? totalCovered = (await _controller?.getPlaybackProperty('totalCovered')) as int?;
copied to clipboard
Buffered Position
Returns an estimate of the position up to which data is buffered.
Future<Duration>? bufferedPosition = _controller?.getBufferedPosition();
copied to clipboard
Media Duration
Returns the total duration of the video.
Future<Duration>? duration = _controller?.getDuration();
copied to clipboard
Playback Position
Returns the current playback position.
Future<Duration>? position = _controller?.getPosition();
copied to clipboard
Please find more APIs here

License

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

Customer Reviews

There are no reviews.