Last updated:
0 purchases
shareplay
A Flutter plugin to use iOS 15.0+ real-time connection SharePlay on a FaceTime call đĨ.
đ§ What is it ? #
This plugin use official iOS GroupActivities API.
share_play can be used to communicate data over devices in a Flutter apps using iOS SharePlay features.
Why using iOS SharePlay?
âĄī¸ It's fast.
đ Reliable (using Apple server).
đ° It's "free" (including in your paid Apple Developer subscription).
đ Very easy to implement (in 3 lines of code you can share data!).
đ Works accros iOS, macOS & tvOS.
â ī¸ share_play is only intended to use with iOS 15.0+!
It will simply do nothing on other platform & < iOS 15.0
đģ Getting started #
âšī¸ You can check into the example repository for a full example.
Open the Xcode workspace project ios/Runner.xcworkspace.
Enable "Group Activities" capabilities on the main Runner app.
Import share_play & create an instance of the Plugin.
import 'package:shareplay/shareplay.dart';
// [...]
final _shareplayPlugin = SharePlay();
copied to clipboard
âšī¸ Quick start #
Add listener when a new message is received (in initState() method for ex).
@override
void initState() {
super.initState();
// [...]
_shareplayPlugin.dataStream().listen((data) {
// do what you want here :)
});
}
copied to clipboard
Start a new activity đ.
_shareplayPlugin.start(title: 'My Activity');
copied to clipboard
Join activity from another device đ˛.
_shareplayPlugin.join();
copied to clipboard
âšī¸ By tapping on the SharePlay banner on top of the screen, you don't need to call join() method!
Send your first message.
_shareplayPlugin.send('Hello from Flutter');
copied to clipboard
âšī¸ For more, check documentation below or example.
đ Documentation #
Name
Description
Returned value
.start()
Create an activity when a FaceTime call is active
Future<bool> State of the new activity is created or not
.join()
Starts the shared activity on the current device, not necessary if user tap on the SharePlay banner
Future When a new activity was joined
.localParticipant()
Use this property to differentiate the participant on the current device from participants on other devices
Future<SPParticipant?> The participant on the current device including participant id
.end()
Ends the activity for the entire group
Future When the activity was stopped
.leave()
Leaves the current activity
Future When the activity was leaved
.send()
Send a message to all other participants
Future When the message was sent
.currentSession()
Get the current session on the device
Future<SPSession?> Current session including session id & activity title
.dataStream()
The stream of messages received from other participants
Stream<SPDataModel> Source participant & message data
.newSessionStream()
A stream of all created sessions
Stream<SPSession> Created session including session id & activity title
.participantsStream()
A stream of all active participants in the current session
Stream<List<SPParticipant>> All active participants in the activity
.sessionStateStream()
A stream of the current session state.
Stream<SPSessionState> Session state (SPSessionState.waiting, SPSessionState.joined or SPSessionState.invalidated)
đĨ Contributions #
Contributions are welcome. Contribute by creating a PR or create an issue đ.
đ¯ Roadmap #
â Add method to check if SharePlay is available.
â Display a custom error when SharePlay is not available on older iOS version.
â Implement prepareForActivation() method.
â
Create stream to handle message data & new session created.
â
Get local data like participant & session state.
â
Leave & end activity.
â
Send a message accros SharePlay.
â
Join an activity.
â
Start a new activity.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.