setPlayerDataSource method
dynamic
setPlayerDataSource(
- DataSource dataSource,
- Player player,
- dynamic seekTo
)
Implementation
setPlayerDataSource(DataSource dataSource, Player player, seekTo) {
duration.value = Duration.zero;
if (dataSource.type == DataSourceType.asset) {
player.open(
Media.asset(dataSource.source!),
autoStart: _autoplay,
);
} else if (dataSource.type == DataSourceType.network) {
print(dataSource.source!);
player.open(
Media.network(
dataSource.source!,
timeout: Duration(seconds: 10),
//startTime: seekTo
),
autoStart: _autoplay,
);
} else {
player.open(
Media.file(
dataSource.file!,
//startTime: seekTo
),
autoStart: _autoplay,
);
}
if (seekTo != Duration.zero) {
this.seekTo(seekTo);
}
return player;
}