Closed hidea closed 2 days ago
Hi @hidea !
Are you using the service
property when creating Bluesky
object? The service
property will be resolved dynamically based on Session
object, but it will not if we use service
property on Bluesky
object.
So you can try:
final bsky = Bluesky.fromSession(
session,
// service: 'SERVICE_NAME', ← Don't use it!
);
In the future, the service
property may need to be completely deprecated when creating Bluesky
object from the session.
Also, video uploads may not be finished immediately, so you need to make sure the upload is complete:
final session = await _session;
final bsky = Bluesky.fromSession(session);
final uploadLimits = await bsky.video.getUploadLimits();
if (uploadLimits.data.canUpload) {
final uploadedVideo = await bsky.video.uploadVideo(
File('video.mov').readAsBytesSync(),
);
Blob? blob = uploadedVideo.data.blob;
while (blob == null) {
final jobStatus = await bsky.video.getJobStatus(
jobId: uploadedVideo.data.jobId,
);
blob = jobStatus.data.jobStatus.blob;
}
await bsky.feed.post(
text: 'Test video',
embed: Embed.video(data: EmbedVideo(video: blob)),
);
}
Thank you for your advice! I changed the code so that the service argument is not passed in fromSession, as you suggested, and now the video upload is successful.
In the previous example, I excluded the exception that occurred before getJobStatus, but I have already dealt with getJobStatus!
Bug Behavior
In my case, Failed posted method ns.appBskyVideoUploadVideo with SocketException.
Expected Behavior
The video should upload correctly.
Error Log
Step to Reproduce
I copied and pasted the code in the example into my project and ran it.
Compared to the code I implemented myself, the following line of code has been changed so that no Socket errors occur.
video_service.dart::uploadVideo