Embedding Live Shows on Magento
Place the following custom script file in
app/code/<Vendor>/Theme/view/frontend/web/js/directory:lora-show.jsdefine(["jquery", "loraPlayerSdk"], function ($, BeLivePlayerWidget) {
"use strict";
return function (config = {}, element) {
if (!$(element).length) return;
var showId = $(element).attr("id");
var player = null;
if (config.component === "displayed-directly") {
player = BeLivePlayerWidget.initialize({
showId,
container: element,
});
} else {
player = BeLivePlayerWidget.initialize({
showId,
triggerElement: element,
});
}
};
});Add LORA Player SDK script and the above
lora-show.jsfile to therequirejs-config.jsfile inapp/code/<Vendor>/Theme/view/frontend/directory:requirejs-config.jsvar config = {
map: {
"*": {
...
loraPlayerSdk: "https://lora-sdk.belive.sg/player-widget/latest/player.min.js",
loraShow: "Magento_Theme/js/lora-show",
},
},
...
};Place the following file
lora_live_shows.phtmlinapp/code/<Vendor>/Theme/view/frontend/templates/js/directory:lora_live_shows.phtml<script type="text/x-magento-init">
{
".lora-live-show": {
"loraShow": {
"component": "watch-button"
}
},
".lora-displayed-directly": {
"loraShow": {
"component": "displayed-directly"
}
}
}
</script>Add the following code to any page or block where you want to display the live shows:
page_layout/my-layout.xml<referenceContainer name="before.body.end">
<block class="Magento\Framework\View\Element\Template" name="lora-shows" as="lora-shows" template="Magento_Theme::js/lora_live_shows.phtml" />
</referenceContainer>Navigate to Magento Admin Dashboard > Content > Elements > Pages

Choose the page where you want to display the live shows, under Action column, click on Select dropdown > Edit.

Within the “Content” section, click on “Show / Hide Editor”. Paste the following code into the text editor and click Save.
<p><button id="23481598-2da4-4cf8-a12e-ff93ea6dece6" class="lora-live-show">Watch Now</button></p>
<div id="23481598-2da4-4cf8-a12e-ff93ea6dece6" class="lora-displayed-directly" style="margin-top: 24px; width: 375px;"></div>
note- Replace the
idwith the actualidof the live show. - The class name
lora-live-showdefines the "Watch Now" button format, whilelora-displayed-directlyis used for the "Displayed Directly" format.
- Replace the
Go to your website and you should see the live shows embedded on the page.
noteIf you are unable to see the live shows embedded on the page, try clearing the cache and refreshing the page.