neeko video player widget
simple video player widget based on video_player. neek supports more actions such as timeline control, toggle fullscreen and so on.
note: this plugin is still under development. pull requests are most welcome.
installation
first, add nekko
as a dependency in your pubspec.yaml file.
ios
warning: the video player is not functional on ios simulators. an ios device must be used during development/testing.
add the following entry to your info.plist file, located in <project root>/ios/runner/info.plist
:
<key>nsapptransportsecurity</key>
<dict>
<key>nsallowsarbitraryloads</key>
<true/>
</dict>
this entry allows your app to access video files by url.
android
ensure the following permission is present in your android manifest file, located in <project root>/android/app/src/main/androidmanifest.xml
:
<uses-permission android:name="android.permission.internet"/>
the flutter project template adds it, so it may already be there.
example
class myhomepage extends statefulwidget {
myhomepage({key key, this.title}) : super(key: key);
final string title;
@override
_myhomepagestate createstate() => _myhomepagestate();
}
class _myhomepagestate extends state<myhomepage> {
// static const string beeuri = 'https://media.w3.org/2010/05/sintel/trailer.mp4';
static const string beeuri =
'http://vfx.mtime.cn/video/2019/03/09/mp4/190309153658147087.mp4';
final videocontrollerwrapper videocontrollerwrapper = videocontrollerwrapper(
datasource.network(
'http://vfx.mtime.cn/video/2019/03/09/mp4/190309153658147087.mp4',
displayname: "displayname"));
@override
void initstate() {
super.initstate();
systemchrome.setenabledsystemuioverlays([systemuioverlay.top]);
}
@override
void dispose() {
systemchrome.restoresystemuioverlays();
super.dispose();
}
@override
widget build(buildcontext context) {
return scaffold(
body: neekoplayerwidget(
onskipprevious: () {
print("skip");
videocontrollerwrapper.preparedatasource(datasource.network(
"http://vfx.mtime.cn/video/2019/03/12/mp4/190312083533415853.mp4",
displayname: "this house is not for sale"));
},
videocontrollerwrapper: videocontrollerwrapper,
actions: <widget>[
iconbutton(
icon: icon(
icons.share,
color: colors.white,
),
onpressed: () {
print("share");
})
],
),
);
}
}
Comments are closed.