Menu

What I learned building a live-streaming widget with Go + SRS (and one iframe)
📰

What I learned building a live-streaming widget with Go + SRS (and one iframe)

DEV Community: go·Cao Wen·about 13 hours ago
#tt7v4RJd
#devtogo#devto#dev#player#merchant
Reading 0:00
15s threshold

I run a small live-selling widget for Shopify and WooCommerce stores. Not a startup — one person, one Go binary, SRS for media. A few decisions turned out to matter more than the feature list, so I'm writing them down.

1. Iframe instead of a script tag

The first version was <script src=".../shell.js" data-key="..."> . It injected a floating player into the merchant's page.

It broke constantly. Theme CSS leaked in, my CSS leaked out, and every third-party script on the page fought with mine. Worse: the API key sat in the DOM of a public storefront page.

What I ship now:

<iframe src = "https://example.com/embed?shop_id=6" width = "375" height = "667" style = "position:fixed;right:20px;bottom:20px;border:0" ></iframe>

Enter fullscreen mode

Exit fullscreen mode

Same iframe, one public shop id, zero secrets in the markup. The merchant pastes four lines. If they break their theme, they don't break the player.

Trade-off: iframe can't inherit the store's fonts.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.