mirror of
https://github.com/d0zingcat/BroadcastChannel.git
synced 2026-05-13 23:16:46 +00:00
feat: add audio handling in posts
Enhances post rendering by integrating audio element processing, ensuring audio files are correctly proxied and controls are enabled for user interaction. This improvement expands multimedia support within posts, enhancing user experience and engagement.
This commit is contained in:
@@ -62,6 +62,13 @@ function getVideo($, item, { staticProxy, index }) {
|
||||
return $.html(video) + $.html(roundVideo)
|
||||
}
|
||||
|
||||
function getAudio($, item, { staticProxy }) {
|
||||
const audio = $(item).find('.tgme_widget_message_voice')
|
||||
audio?.attr('src', staticProxy + audio?.attr('src'))
|
||||
?.attr('controls', true)
|
||||
return $.html(audio)
|
||||
}
|
||||
|
||||
function getLinkPreview($, item, { staticProxy, index }) {
|
||||
const link = $(item).find('.tgme_widget_message_link_preview')
|
||||
const title = $(item).find('.link_preview_title')?.text() || $(item).find('.link_preview_site_name')?.text()
|
||||
@@ -111,13 +118,13 @@ function getPost($, item, { channel, staticProxy, index = 0 }) {
|
||||
$.html($(item).find('.tgme_widget_message_reply')?.wrapInner('<small></small>')?.wrapInner('<blockquote></blockquote>')),
|
||||
getImages($, item, { staticProxy, id, index, title }),
|
||||
getVideo($, item, { staticProxy, id, index, title }),
|
||||
getAudio($, item, { staticProxy, id, index, title }),
|
||||
content?.html(),
|
||||
getImageStickers($, item, { staticProxy, index }),
|
||||
getVideoStickers($, item, { staticProxy, index }),
|
||||
// $(item).find('.tgme_widget_message_sticker_wrap')?.html(),
|
||||
$(item).find('.tgme_widget_message_poll')?.html(),
|
||||
$.html($(item).find('.tgme_widget_message_document_wrap')),
|
||||
$.html($(item).find('.tgme_widget_message_voice')?.attr('controls', true)),
|
||||
$.html($(item).find('.tgme_widget_message_location_wrap')),
|
||||
getLinkPreview($, item, { staticProxy, index }),
|
||||
].filter(Boolean).join('').replace(/(url\(["'])((https?:)?\/\/)/g, (match, p1, p2, _p3) => {
|
||||
|
||||
Reference in New Issue
Block a user