AmityVideoClient.newStreamRepository().getStreams() doesn’t return live streams
I tried to retrieve streams by two different ways:
-
streams =
await AmityVideoClient.newStreamRepository().getStreams().query();
this is single API query which you call once and it returns all the streams (included live and recorded)
This is streamsubscription, and I see recorded and idle (created) streams… but the problem is - once I start livestreaming for newly created livestream - this stream is disappeared from subscription events
And after I finish streaming video - this event return back to livestreams list with status “Recorded”
Can you resolve this issue ?
Hello @Yarshau, thank you for providing the information. May I know your current Flutter SDK version, pls?
[✓] Flutter (Channel stable, 3.24.3, on macOS 15.0 darwin-arm64, locale en-GB)
amity_sdk: ^0.51.0
amity_video_player: ^0.0.3
1 Like
Thank you @Yarshau , for providing all the necessary information. We have forwarded it to the team for further investigation. We will keep you updated on the progress.
Hello @SocialPlus_Support, any updates on it ?
Hello @Yarshau , Our team is currently working on your issue. We will update you as soon as we have more information.
Thank you for your patience. Please let us know if you need further assistance.
Hello @Yarshau ,
To resolve this issue, we suggest following the example code below and subscribing to the live collection again:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await AmityCoreClient.setup(
option: AmityCoreClientOption(
apiKey: "xxxxxxxx",
httpEndpoint: AmityRegionalHttpEndpoint.SG,
mqttEndpoint: AmityRegionalMqttEndpoint.SG,
showLogs: true),
sycInitialization: true);
runApp(const MyApp());
}
This should help manage the stream subscription and address the issue where live streams disappear during streaming. Please try this approach and let us know if it resolves the problem.
I use AmityUIkit for setup, and doing exactly same
await AmityUIKit().setup(
apikey: 'xxxxxx',
region: AmityEndpointRegion.us, );
that not helped
[/quote]
Hello @Yarshau, could you please ensure that there’s a brief delay after the setup as well?
await AmityCoreClient.login("AUTEST_CHAT_TODAY")
.submit()
.then((value) {
print("login success");
print(value);
}).onError((error, stackTrace) {
print(error);
});
and try to subscribe to livecollection again.
subscribe to livestream:
late StreamLiveCollection streamLiveCollection;
late StreamSubscription<List<AmityStream>> _subscription;
final _amityStream = <AmityStream>[];
Future queryLiveStream() async {
print("queryLiveStream");
streamLiveCollection =
AmityVideoClient.newStreamRepository().getStreams().status([
AmityStreamStatus.live,
AmityStreamStatus.ended,
AmityStreamStatus.idle,
AmityStreamStatus.recorded
]).getLiveCollection();
_subscription =
streamLiveCollection.getStreamController().stream.listen((streams) {
if (streamLiveCollection.isFetching == true && streams.isEmpty) {
// Handle loading state
print("Loading streams...");
} else if (streams.isNotEmpty) {
_amityStream.clear();
_amityStream.addAll(streams);
for (var stream in _amityStream) {
print("${stream.streamId} : ${stream.title} : ${stream.status}");
}
print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>..");
// Update widgets if necessary
}
});
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
streamLiveCollection.loadNext();
});
}
If you’ve followed all the steps and are still experiencing the issue, please provide your current code and our team will help review.