import 'package:arcore_flutter_plugin/arcore_flutter_plugin.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:vector_math/vector_math_64.dart';
class ArDemo extends StatefulWidget {
const ArDemo({Key? key}) : super(key: key);
@override
State<ArDemo> createState() => _ArDemoState();
}
class _ArDemoState extends State<ArDemo> {
late ArCoreController arCoreController;
@override
void dispose() {
arCoreController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Earth Sample')),
body: Container(
child: ArCoreView(
type: ArCoreViewType.AUGMENTEDIMAGES,
onArCoreViewCreated: onArCoreViewCreated),
),
);
}
Future<void> onArCoreViewCreated(ArCoreController arCoreController) async {
ByteData byteData = await rootBundle.load('assets/earth.jpg');
Uint8List bytes = byteData.buffer.asUint8List();
this.arCoreController = arCoreController;
final image = ArCoreImage(bytes: bytes);
final node = ArCoreReferenceNode(
children: [ArCoreNode(image: image)],
objectUrl: "https://www.youtube.com/watch?v=mPPPMVBu-is",
rotation: Vector4.zero(),
position: Vector3(0, 0, 0),
);
this.arCoreController.addArCoreNode(node);
}
}
hear is my Code and I want to play video while image is detected in android device. but not work this time
dependencies: arcore_flutter_plugin: ^0.0.11