iscflutterplugin 1.0.1
iscflutterplugin: ^1.0.1 copied to clipboard
A Flutter plugin to play hikvision isc platform. It used hikvision native library, *.so for java and *.a for ios.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:iscflutterplugin/isc_http.dart';
import 'package:iscflutterplugin/isc_player.dart';
import 'package:iscflutterplugin/iscflutterplugin.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
Iscflutterplugin _controller;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('海康isc播放器插件,支持android/ios'),
),
body: Column(
children: <Widget>[
Container(
width: 500,
height: 300,
color: Colors.black,
child: IscPlayerWidget(
onCreated: _onCreated,
),
),
RaisedButton(child: Text("预览"), onPressed: _onPress),
],
),
),
);
}
void _onCreated(controller) {
print('_onCreated');
_controller = controller;
}
void _onPress() async {
//初始化配置
ArtemisConfig.host = "xxx";
ArtemisConfig.appKey = "xxx";
ArtemisConfig.appSecret = "xxx";
var cameraCode = 'xxx';
//获取预览地址
String _previewUrl =
await IscApi.getPreviewURL(cameraIndexCode: cameraCode);
print('ret = $_previewUrl');
//设置播放器状态回调
_controller.setStatusCallback((status) {
print('status = ${_controller.getStatusMessage(status)}');
});
//预览
_controller.startRealPlay(_previewUrl);
}
}