openVideoBubbleAsset method
void
openVideoBubbleAsset(
- String asset, {
- int startTimeInMilliseconds = 0,
- ControlsType controlsType = ControlsType.STANDARD,
- dynamic onEndServiceTask,
Start Video Bubble service and show the bubble
asset
specifies the uri of the file
startTimeInMilliseconds
specify where to start watching the video in milliseconds
controlsType
type of (ui) controls to show on the mini video player (all type avaiable in the enum ControlsType)
onEndServiceTask
callback to call after end of the service. Useful for setting a new time on the main media player
Implementation
void openVideoBubbleAsset(String asset,
{int startTimeInMilliseconds = 0,
ControlsType controlsType = ControlsType.STANDARD,
onEndServiceTask}) async {
ByteData data = await rootBundle.load(asset);
List<int> bytes =
data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
Directory directory = await getApplicationDocumentsDirectory();
String dbPath = join(directory.path, 'video.mp4');
File file = await File(dbPath).writeAsBytes(bytes);
String path = file.path;
openVideoBubble(path,
startTimeInMilliseconds: startTimeInMilliseconds,
controlsType: controlsType,
onEndServiceTask: onEndServiceTask);
}