From b030b7219d2a82b6f8a821f7ace493252da4af8d Mon Sep 17 00:00:00 2001 From: Daniel Dallos Date: Thu, 24 Oct 2024 16:21:40 +0200 Subject: [PATCH 1/3] added extra THEOlive API usage --- .../example/lib/main.dart | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/flutter_theoplayer_sdk/flutter_theoplayer_sdk/example/lib/main.dart b/flutter_theoplayer_sdk/flutter_theoplayer_sdk/example/lib/main.dart index 526ed57..33bf0e6 100755 --- a/flutter_theoplayer_sdk/flutter_theoplayer_sdk/example/lib/main.dart +++ b/flutter_theoplayer_sdk/flutter_theoplayer_sdk/example/lib/main.dart @@ -54,6 +54,8 @@ class _MyAppState extends State { }, theoPlayerConfig: THEOplayerConfig( license: PLAYER_LICENSE, + // Extra THEOlive configuration: + //theolive: TheoLiveConfiguration(externalSessionId: "mySessionID"), ), onCreate: () { print("main - THEOplayer - onCreate"); @@ -82,6 +84,7 @@ class _MyAppState extends State { var pmd = pmEvent as PresentationModeChangeEvent; print("New presentation mode: ${pmd.presentationMode}"); }); + }); } @@ -186,6 +189,35 @@ class _MyAppState extends State { onPressed: () { _licenseConfigCheckDialog(context); + /** + * register for theolive events, if interested + * + * + player.theoLive?.addEventListener(THEOliveApiEventTypes.PUBLICATIONLOADSTART, (e) { + print("PUBLICATIONLOADSTART"); + }); + player.theoLive?.addEventListener(THEOliveApiEventTypes.PUBLICATIONOFFLINE, (e) { + print("PUBLICATIONOFFLINE"); + }); + player.theoLive?.addEventListener(THEOliveApiEventTypes.PUBLICATIONLOADED, (e) { + print("PUBLICATIONLOADED"); + }); + player.theoLive?.addEventListener(THEOliveApiEventTypes.INTENTTOFALLBACK, (e) { + print("INTENTTOFALLBACK"); + }); + player.theoLive?.addEventListener(THEOliveApiEventTypes.ENTERBADNETWORKMODE, (e) { + print("ENTERBADNETWORKMODE"); + }); + player.theoLive?.addEventListener(THEOliveApiEventTypes.EXITBADNETWORKMODE, (e) { + print("EXITBADNETWORKMODE"); + }); + */ + + /** + * preload channels for faster startup + * + player.theoLive?.preloadChannels(["2vqqekesftg9zuvxu9tdme6kl"]); + */ player.source = SourceDescription(sources: [ TheoLiveSource(src: "2vqqekesftg9zuvxu9tdme6kl"), ]); @@ -282,7 +314,14 @@ class _MyAppState extends State { print("error: ${player.error}"); print("audio target quality: ${player.audioTracks.first.targetQuality?.uid}"); print("audio active quality: ${player.audioTracks.first.activeQuality?.uid}"); + print("video target quality: ${player.videoTracks.first.targetQuality?.uid}"); + print("video active quality: ${player.videoTracks.first.activeQuality?.uid}"); print("allowBackgroundPlayback: ${player.allowBackgroundPlayback}"); + + if (kIsWeb) { + print("theolive publicaitionState: ${player.theoLive?.publicationState}"); + print("theolive badnetwork: ${player.theoLive?.badNetworkMode}"); + } } Future _licenseConfigCheckDialog(BuildContext context) async { From ab285f21dabee37d485724a5cc405bc21c37ac24 Mon Sep 17 00:00:00 2001 From: Daniel Dallos Date: Thu, 24 Oct 2024 18:00:21 +0200 Subject: [PATCH 2/3] added THEOlive doc --- doc/theolive.md | 161 ++++++++++++++++++ .../flutter_theoplayer_sdk/README.md | 10 +- 2 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 doc/theolive.md diff --git a/doc/theolive.md b/doc/theolive.md new file mode 100644 index 0000000..afc72c0 --- /dev/null +++ b/doc/theolive.md @@ -0,0 +1,161 @@ +# THEOlive support + +High-quality real-time video streaming at scale for providers of sports betting, iGaming and interactive entertainment + +For more info, visit [THEOlive website](https://www.theoplayer.com/product/theolive). + +## Limitations + +* Only Flutter Web is supported. +* Android and iOS will follow later. (You can check out our dedicated [THEOlive Flutter SDK](https://github.com/THEOplayer/flutter-theolive-sdk)) + +## THEOlive playback +THEOlive playback is becoming crucial part of THEOplayer's playback engine instead of being available as a separate SDK. + +The WEB support is already added, Android and iOS support as part of the THEOplayer SDK will come later. (Right now you can use the [dedicated THEOlive Flutter SDK](https://github.com/THEOplayer/flutter-theolive-sdk) for Android and iOS support) + +### Setting a THEOlive source + +```js +player.source = SourceDescription(sources: [ + TheoLiveSource(src: "2vqqekesftg9zuvxu9tdme6kl"), +]); +``` + +Instead of using a remote HTTPS url, you can just specify your `channelID` from the [THEOlive Console](https://console.theo.live/) and you can start the playback. + +**NOTE:** your THEOplayer license has to contain the `HESP` feature to make it work. (HESP is the underlying technology of THEOlive). + +Once the playback starts, you can listen to playback-specify events on THEOplayer. + +#### Additional configuration options on `THEOPlayerConfig` +By setting a `THEOliveConfiguration` object on `THEOplayerConfig` you are able to specify extra configuration for THEOlive (e.g. a custom sessionId to follow the requests on the backend) +```js + player = THEOplayer( + theoPlayerConfig: THEOplayerConfig( + license: PLAYER_LICENSE, + theolive: TheoLiveConfiguration(externalSessionId: "mySessionID"), + ), + onCreate: () { + print("player is created, ready to use"); + + }); +``` +### Listening for THEOlive-specific events + +```js + player.theoLive?.addEventListener(THEOliveApiEventTypes.PUBLICATIONLOADSTART, (e) { + print("PUBLICATIONLOADSTART"); + }); + player.theoLive?.addEventListener(THEOliveApiEventTypes.PUBLICATIONOFFLINE, (e) { + print("PUBLICATIONOFFLINE"); + }); + player.theoLive?.addEventListener(THEOliveApiEventTypes.PUBLICATIONLOADED, (e) { + print("PUBLICATIONLOADED"); + }); + player.theoLive?.addEventListener(THEOliveApiEventTypes.INTENTTOFALLBACK, (e) { + print("INTENTTOFALLBACK"); + }); + player.theoLive?.addEventListener(THEOliveApiEventTypes.ENTERBADNETWORKMODE, (e) { + print("ENTERBADNETWORKMODE"); + }); + player.theoLive?.addEventListener(THEOliveApiEventTypes.EXITBADNETWORKMODE, (e) { + print("EXITBADNETWORKMODE"); + }); +``` + +## Migration from THEOlive Flutter SDK to THEOplayer Flutter SDK + +### setStateListener +From +```js +theoLive.setStateListener(...) +``` + +to +```js +player.theoLive.setStateListener(...) +``` + +### loadChannel +From +```js +theoLive.loadChannel("2vqqekesftg9zuvxu9tdme6kl") +``` + +to +```js +player.source = SourceDescription(sources: [ + TheoLiveSource(src: "2vqqekesftg9zuvxu9tdme6kl"), +]); +``` + +### addEventListener +From +```js +theoLive.addEventListener(this) +``` + +to THEOlive-related events +```js + player.theoLive?.addEventListener(THEOliveApiEventTypes.PUBLICATIONLOADSTART, (e) { + print("PUBLICATIONLOADSTART event"); + }); + player.theoLive?.addEventListener(THEOliveApiEventTypes.PUBLICATIONOFFLINE, (e) { + print("PUBLICATIONOFFLINE event"); + }); + player.theoLive?.addEventListener(THEOliveApiEventTypes.PUBLICATIONLOADED, (e) { + print("PUBLICATIONLOADED event"); + }); + player.theoLive?.addEventListener(THEOliveApiEventTypes.INTENTTOFALLBACK, (e) { + print("INTENTTOFALLBACK event"); + }); + player.theoLive?.addEventListener(THEOliveApiEventTypes.ENTERBADNETWORKMODE, (e) { + print("ENTERBADNETWORKMODE event"); + }); + player.theoLive?.addEventListener(THEOliveApiEventTypes.EXITBADNETWORKMODE, (e) { + print("EXITBADNETWORKMODE event"); + }); +``` + +and to playback-related events +```js + player.addEventListener(PlayerEventTypes.PLAY, (e) { + print("PLAY event"); + }); + player.addEventListener(PlayerEventTypes.PLAYING, (e) { + print("PLAYING event"); + }); + player.addEventListener(PlayerEventTypes.PAUSE, (e) { + print("PAUSE event"); + });); +``` + +### Playback-related actions +From +```js +theoLive.play() +``` + +to +```js +player.play() +``` + +### Channel events +The channel related events: +```js +ChannelLoadStart, +ChannelLoaded, +ChannelOffline +``` + +are renamed to `Publication` events +```js +PublicationLoadStart, +PublicationLoaded, +PublicationOffline +``` + +### Anything missing? +Please reach out to us! \ No newline at end of file diff --git a/flutter_theoplayer_sdk/flutter_theoplayer_sdk/README.md b/flutter_theoplayer_sdk/flutter_theoplayer_sdk/README.md index 5c82265..a8bb5bc 100755 --- a/flutter_theoplayer_sdk/flutter_theoplayer_sdk/README.md +++ b/flutter_theoplayer_sdk/flutter_theoplayer_sdk/README.md @@ -83,7 +83,9 @@ please reach out to us for support. Subtitles & Closed Captions -In-stream subtitles supported by the platform +In-stream subtitles supported by the platform.
+Note: If you use Texture-based rendering (SURFACE_TEXTURE and SURFACE_PRODUCER) on Android, you need to implement the subtitle rendering based on track events. + Metadata @@ -111,6 +113,12 @@ please reach out to us for support. Cast Integration Coming soon… (Can not wait? Check our in-app integration branches) + +THEOlive +Coming soon… (Can not wait? You can still use our THEOlive SDK) +Supported through THEOliveSource and player.theolive API +Coming soon… (Can not wait? You can still use our THEOlive SDK) + From 0b92f08e4a559d7c5a114879675f610b4c882040 Mon Sep 17 00:00:00 2001 From: Daniel Dallos Date: Thu, 24 Oct 2024 18:01:52 +0200 Subject: [PATCH 3/3] updated changelog --- flutter_theoplayer_sdk/flutter_theoplayer_sdk/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/flutter_theoplayer_sdk/flutter_theoplayer_sdk/CHANGELOG.md b/flutter_theoplayer_sdk/flutter_theoplayer_sdk/CHANGELOG.md index ff9501e..e153f8e 100644 --- a/flutter_theoplayer_sdk/flutter_theoplayer_sdk/CHANGELOG.md +++ b/flutter_theoplayer_sdk/flutter_theoplayer_sdk/CHANGELOG.md @@ -1,5 +1,6 @@ [Unreleased] +* Added [THEOlive support](https://github.com/THEOplayer/flutter-theoplayer-sdk/blob/main/doc/theolive.md) for Flutter WEB. * Deprecated getX and setX methods on THEOplayer API in favor of properties. * Added new properties on THEOplayer API. (`muted`, `played`, `buffered`, `videoTracks`, etc... for the full list check the API.) * Changed `THEOplayer.allowBackgroundPlayback()` to `THEOplayer.allowBackgroundPlayback`. **(Breaking change)**.