-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: add ShortVideo
message support
#2739
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Closed
StageGuard
added
t:feature
类型: 新特性
x:protocol
属性: 协议相关
N
优先级: 一般
s:core
子系统: mirai-core
labels
Jul 24, 2023
好了叫我 review 一下 |
Karlatemp
reviewed
Aug 3, 2023
mirai-core-api/src/commonMain/kotlin/message/code/internal/impl.kt
Outdated
Show resolved
Hide resolved
mirai-core-api/src/commonMain/kotlin/message/data/ShortVideo.kt
Outdated
Show resolved
Hide resolved
Him188
reviewed
Aug 3, 2023
mirai-core-api/src/commonMain/kotlin/event/events/ShortVideoUploadEvent.kt
Outdated
Show resolved
Hide resolved
mirai-core-api/src/commonMain/kotlin/event/events/ShortVideoUploadEvent.kt
Outdated
Show resolved
Hide resolved
mirai-core-api/src/commonMain/kotlin/event/events/ShortVideoUploadEvent.kt
Outdated
Show resolved
Hide resolved
mirai-core-api/src/commonMain/kotlin/message/code/internal/impl.kt
Outdated
Show resolved
Hide resolved
mirai-core-api/src/commonMain/kotlin/message/data/ShortVideo.kt
Outdated
Show resolved
Hide resolved
mirai-core/src/commonMain/kotlin/message/ReceiveMessageHandler.kt
Outdated
Show resolved
Hide resolved
…ernal resources for combined calculation.
…l` to `RefineContext`
Him188
reviewed
Aug 12, 2023
mirai-core-api/src/commonMain/kotlin/event/events/ShortVideoUploadEvent.kt
Outdated
Show resolved
Hide resolved
mirai-core-api/src/commonMain/kotlin/event/events/ShortVideoUploadEvent.kt
Outdated
Show resolved
Hide resolved
mirai-core-api/src/commonMain/kotlin/message/data/ShortVideo.kt
Outdated
Show resolved
Hide resolved
mirai-core-api/src/commonMain/kotlin/message/data/ShortVideo.kt
Outdated
Show resolved
Hide resolved
mirai-core-api/src/commonMain/kotlin/message/data/ShortVideo.kt
Outdated
Show resolved
Hide resolved
mirai-core/src/commonMain/kotlin/contact/roaming/TimeBasedRoamingMessagesImpl.kt
Outdated
Show resolved
Hide resolved
mirai-core/src/commonMain/kotlin/contact/roaming/TimeBasedRoamingMessagesImpl.kt
Outdated
Show resolved
Hide resolved
mirai-core/src/commonMain/kotlin/message/ReceiveMessageHandler.kt
Outdated
Show resolved
Hide resolved
Him188
approved these changes
Aug 16, 2023
# Conflicts: # mirai-core-api/src/commonMain/kotlin/contact/Contact.kt # mirai-core-api/src/jvmBaseMain/kotlin/contact/Contact.kt # mirai-core-api/src/jvmBaseMain/kotlin/utils/ExternalResource.kt
Him188
requested changes
Aug 16, 2023
无比期待 |
Contact.uploadShortVideo必须要有缩略图吗 |
协议上是需要。在 QQ 客户端中通常是自动截取视频文件中间的某一帧作为缩略图。但是 mirai 没有解码视频的能力,所以需要用户自行处理。 |
Him188
approved these changes
Aug 20, 2023
Karlatemp
reviewed
Aug 20, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No other issue
mirai-core/src/commonMain/kotlin/message/protocol/impl/ShortVideoProtocol.kt
Outdated
Show resolved
Hide resolved
牛逼! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
close #867, #1664, #2011, partially #2621
短视频消息
ShortVideo
短视频消息,指的是可在聊天界面在线播放的视频消息,而非在群文件上传的视频文件.
短视频消息分为
OnlineShortVideo
与OfflineShortVideo
. 在本地上传的短视频为OfflineShortVideo
. 从服务器接收的短视频为OnlineShortVideo
.最推荐存储的方式是下载视频文件,每次都通过上传该文件获取视频消息.
在上传视频时服务器会根据缓存情况选择回复已有视频 ID 或要求客户端上传.
获取短视频消息示例
上传短视频
使用
Contact.uploadShortVideo
,将视频缩略图和视频资源``ExternalResource
上传以得到OfflineShortVideo
.使用
Builder
构建短视频ShortVideo
提供Builder
构建方式,必须指定videoId
,fileName
,fileMd5
,fileSize
和fileFormat
参数.可选指定
Builder.thumbnailMd5
和Builder.thumbnailSize
. 若不提供,可能会影响服务器判断缓存.从服务器接收
通过监听消息接收的短视频消息可直接转换为
OnlineShortVideo
.下载视频
通过
OnlineShortVideo.urlForDownload
获取下载链接.该下载链接不包含短视频的文件信息,可以使用
videoId
或fileName
作为文件名,fileFormat
作为文件拓展名.其他信息
mirai 码支持
ShortVideo
不支持 mirai 码,意味着如果通过 mirai 码持久化消息,短视频消息将不会被存储.