Getting Started with Flutter
Usage
We have migrated THEOlive Flutter support to be a feature of the THEOplayer Flutter SDK.
To use Flutter for THEOlive playback, you must use the THEOplayer Flutter SDK which now supports Web, Android, and iOS devices. The following steps will ensure your project is setup optimally:
- Review the THEOplayer Flutter SDK limitations to ensure your use case needs are supported before starting development.
- Follow along with the THEOplayer Flutter SDK minimal setup guide to setup a basic THEOlive project.
- Check the THEOlive support guide for the latest THEOlive Flutter updates.
For customers currently using the now deprecated THEOlive SDK for playback, please migrate to using the THEOplayer SDK with the following THEOlive migration guide to always have the latest updates.
Flutter project setup
Run the following script to generate boilerplate code for your Flutter project:
$ flutter create -a kotlin -i swift -t app --org com.theoplayer --description "New THEOlive project" --project-name "theolive_sample_app" --platform ios,android theolive_sample_app
Initializing a THEOplayer instance
Configure the THEOplayer by setting your THEOplayer license on the license
property and optionally providing a theolive
property for custom configuration:
late THEOplayer player;
void initState() {
super.initState();
player = THEOplayer(
theoPlayerConfig: THEOplayerConfig(
license: "YOUR_PLAYER_LICENSE_STRING",
// Extra THEOlive configuration - set a custom sessionId to follow the requests on the backend
theolive: TheoLiveConfiguration(externalSessionId: "mySessionID"),
),
onCreate: () {
print("THEOplayer is created and ready to use");
});
}
Add a THEOlive source
After initializing a THEOplayer instance in your Flutter project, set its source with a SourceDescription
containing a TheoLiveSource
:
// a THEOlive channel ID is entered for the theoLiveSource 'src' property
player.source = SourceDescription(sources: [
TheoLiveSource(src: "2vqqekesftg9zuvxu9tdme6kl"),
]);
Next steps
If you've followed the steps above, you should now have a boilerplate THEOlive Flutter application to further develop your project from.
Use Flutter documentation along with our basic playback guide for Flutter to develop your project.