Closed imthatcarlos closed 12 months ago
Lenster currently uses iFramely to handle embeds from content body, see:
lenster/PublicationBody.tsx at main · lensterxyz/lenster
“Embedded” images, videos or audio, are only handled by their own React components through attachments.
Soundcloud
URL
Content
// 20230314081910
// https://iframely.lenster.xyz/iframely?url=https://soundcloud.com/divulgamusic2019/mc-cabelinho-little-love-album-completo-audio-oficial?in_system_playlist=charts-top%3Aall-music%3Abr
{
"meta": {
"title": "MC CABELINHO - LITTLE LOVE ALBUM COMPLETO AUDIO OFICIAL @DJGBLNTR by AS MELHORES MUSICAS DO MOMENTO ♪",
"site": "SoundCloud",
"author": "AS MELHORES MUSICAS DO MOMENTO ♪",
"author_url": "https://soundcloud.com/divulgamusic2019",
"description": "FACEBOOK: www.facebook.com/djgblntr\nINSTAGRAM: www.instagram.com/djgblntr/\nTWITTER : twitter.com/Djgblntr\n-> TWITTER : @DJGBLNTR < - SIGAAAAA\n-> TWITTER : @DJGBLNTR < - SIGAAAAA\n-> TWITTER : @DJGBLNTR < - SIGAAAAA\n-> TWITTER : @DJGBLNTR < - SIGAAAAA",
"canonical": "https://soundcloud.com/divulgamusic2019/mc-cabelinho-little-love-album-completo-audio-oficial?in_system_playlist=charts-top:all-music:br",
"medium": "audio"
},
"links": {
"player": [
{
"href": "https://w.soundcloud.com/player/?visual=false&url=https%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F1406908771&show_artwork=true",
"type": "text/html",
"rel": [
"player",
"audio",
"ssl",
"html5"
],
"media": {
"height": 166
},
"options": {
"_horizontal": {
"label": "Slimmer horizontal player",
"value": true
},
"_hide_comments": {
"label": "Hide timed comments",
"value": false
},
"_hide_artwork": {
"label": "Hide artwork",
"value": false
}
},
"html": "<iframe src=\"https://w.soundcloud.com/player/?visual=false&url=https%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F1406908771&show_artwork=true\" style=\"border: 0; width: 100%; height: 166px;\" allowfullscreen allow=\"encrypted-media\"></iframe>"
},
{
"href": "https://w.soundcloud.com/player/?visual=false&url=https%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F1406908771&show_artwork=true&auto_play=true",
"type": "text/html",
"rel": [
"player",
"audio",
"ssl",
"autoplay",
"html5"
],
"media": {
"height": 166
},
"options": {
"_horizontal": {
"label": "Slimmer horizontal player",
"value": true
},
"_hide_comments": {
"label": "Hide timed comments",
"value": false
},
"_hide_artwork": {
"label": "Hide artwork",
"value": false
}
},
"html": "<iframe src=\"https://w.soundcloud.com/player/?visual=false&url=https%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F1406908771&show_artwork=true&auto_play=true\" style=\"border: 0; width: 100%; height: 166px;\" allowfullscreen allow=\"encrypted-media; autoplay\"></iframe>"
}
],
"thumbnail": [
{
"href": "https://i1.sndcdn.com/artworks-B4uK01Bly9YnPg3C-jmyKzQ-t500x500.jpg",
"type": "image/jpeg",
"rel": [
"thumbnail",
"oembed",
"ssl"
]
}
],
"icon": [
{
"href": "https://a-v2.sndcdn.com/assets/images/sc-icons/favicon-2cadd14bdb.ico",
"rel": [
"icon",
"ssl"
],
"type": "image/icon"
},
{
"href": "https://a-v2.sndcdn.com/assets/images/sc-icons/ios-a62dfc8fe7.png",
"rel": [
"apple-touch-icon",
"icon",
"ssl"
],
"type": "image/png"
},
{
"href": "https://a-v2.sndcdn.com/assets/images/sc-icons/fluid-b4e7a64b8b.png",
"rel": [
"fluid-icon",
"icon",
"ssl"
],
"type": "image/png"
}
]
},
"rel": [
"player",
"audio",
"ssl",
"html5"
],
"html": "<iframe src=\"https://w.soundcloud.com/player/?visual=false&url=https%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F1406908771&show_artwork=true\" style=\"border: 0; width: 100%; height: 166px;\" allowfullscreen allow=\"encrypted-media\"></iframe>",
"options": {
"_horizontal": {
"label": "Slimmer horizontal player",
"value": true
},
"_hide_comments": {
"label": "Hide timed comments",
"value": false
},
"_hide_artwork": {
"label": "Hide artwork",
"value": false
}
}
}
Spinamp
URL
Content
// 20230314084633
// https://iframely.lenster.xyz/iframely?url=https://app.spinamp.xyz/track/ideal-mixtape-thirty-dedicated-to-snd-and-deepchord-1678740294059
{
"meta": {
"description": "Eric Schmid",
"title": "iDEAL MiXTAPE THiRTY - Dedicated To SND And Deepchord",
"medium": "audio",
"canonical": "https://app.spinamp.xyz/track/ideal-mixtape-thirty-dedicated-to-snd-and-deepchord-1678740294059",
"site": "Spinamp"
},
"links": {
"player": [
{
"href": "https://app.spinamp.xyz/embed/player/solana%2FGvvfStxxaiT6vHDcQrEnhKfTc8BTUptACqJYKiSJRueY",
"rel": [
"player",
"twitter",
"allow",
"responsive",
"html5",
"audio",
"ssl"
],
"media": {
"aspect-ratio": 1,
"scrolling": "no"
},
"type": "text/html",
"html": "<div style=\"max-width: 100vh;\"><div style=\"left: 0; width: 100%; height: 0; position: relative; padding-bottom: 100%;\"><iframe src=\"https://app.spinamp.xyz/embed/player/solana%2FGvvfStxxaiT6vHDcQrEnhKfTc8BTUptACqJYKiSJRueY\" style=\"border: 0; top: 0; left: 0; width: 100%; height: 100%; position: absolute;\" allowfullscreen scrolling=\"no\" allow=\"encrypted-media\"></iframe></div></div>"
}
],
"thumbnail": [
{
"href": "https://media.spinamp.xyz/v1/QmT8zs8rUNhk3HGFo9U4x13awskwULrxu8gvg79aNrHnLD?img-width=750&img-fit=cover&transform=f_jpg",
"type": "image",
"rel": [
"twitter",
"thumbnail",
"ssl",
"og"
]
}
],
"icon": [
{
"href": "https://app.spinamp.xyz/favicon.ico",
"rel": [
"shortcut",
"icon",
"ssl"
],
"type": "image/x-icon"
}
]
},
"rel": [
"player",
"twitter",
"allow",
"responsive",
"html5",
"audio",
"ssl"
],
"html": "<div style=\"max-width: 100vh;\"><div style=\"left: 0; width: 100%; height: 0; position: relative; padding-bottom: 100%;\"><iframe src=\"https://app.spinamp.xyz/embed/player/solana%2FGvvfStxxaiT6vHDcQrEnhKfTc8BTUptACqJYKiSJRueY\" style=\"border: 0; top: 0; left: 0; width: 100%; height: 100%; position: absolute;\" allowfullscreen scrolling=\"no\" allow=\"encrypted-media\"></iframe></div></div>"
}
React sets HTML via innerHTML
. Per HTML5 specification, any <script>
tag is ignored. It means that rich media from publishers like Twitter, Instagram, Facebook and TikTok will not work out-of-the-box and require a hosted iFrame.
Given that, there are a few possible solutions that I can think of right now:
Create react audio component to be copy and pasted to each project we need to include.
This is the hacky way, which definitely will break things, and we quickly run into simple issues such as:
clubspace-sdk
becoming a dependency of every project;Both youtube and spotify (the only ones I see that support live streaming) have a 2 step process to handle widgets that happen when adding the code to embed.
The first step seems to only make the new origin a trusted one, and then load the next script.
Spinamp on the other hand, when you pass a URL to an iframe or a crawler, it redirects to a /embed
version, which returns the proper media type and everything, as it includes a embed.bundle.js
script.
Looking into IFramely, we will have to embed the whole html by introducing the joinclubspace
domain to the known domains, just like oohlala_xyz and lenstube, then it's easy to add support to our widget on lenster, as we just need to:
allowedSites
Yeah I think supporting IFramely is the move, as it’ll be easier (in theory) to support future clients. I can add the domain to the known domains later today, is that all you would need to keep going with dev? Or do we need to setup some staging env as well (we have staging.join….)
Don't think we need staging, as the sdk creates a clubspace on mainnet, I can just add the meta tags to the [handle]
page, and create the embed/[handle]
page.
This can be seen in the oohlala.xyz.
Possible problems with this (not sure, just guessing):
[joinclubspace.xyz/live/somehandle.lens](http://joinclubspace.xyz/live/somehandle.lens)
and via the sdk, you can make the GET request. if the responseobject.ended
is undefined, we’re gucci and can render the audio player component. else, maybe something that shows how many ppl showed up, how many sales, how long it lasted, etc. this report data isn’t returned in the sdk now but can be.startAt
property, which means the widget should be static, showing the local time when it will start