vdocipher_flutter 2.6.8 vdocipher_flutter: ^2.6.8 copied to clipboard
A VdoCipher plugin for flutter apps. This Plugin will help to serve content on supported platform app with Hollywood grade security to prevent video piracy.
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
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.8
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';
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"
)
);
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;
}
}
Playback Control Methods #
Play
Start or resume playing the video.
_controller?.play()
Pause
Pause video playback.
_controller?.pause()
Seek
Seek to the specified target position.
Duration target = Duration(seconds: 30);
_controller?.seek(target);
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?;
Buffered Position
Returns an estimate of the position up to which data is buffered.
Future<Duration>? bufferedPosition = _controller?.getBufferedPosition();
Media Duration
Returns the total duration of the video.
Future<Duration>? duration = _controller?.getDuration();
Playback Position
Returns the current playback position.
Future<Duration>? position = _controller?.getPosition();
Please find more APIs here