So I tried something here as you suggested I created a different variant and function for the fullscreen version and through index of Player where I handle the case for rendering the specific function based on player variant I did this and it solved the main issue in hand which was having different set of UI components for fullscreen and without fullscreen
case PlayerVariationEnum.SMALL:
player.on(player.exports.PlayerEvent.Playing, () => {
if (player.getViewMode() === ViewMode.Fullscreen) {
setUIManager(buildDefaultFullScreenUI(player, {}, playConfig))
} else {
setUIManager(buildDefaultSmallScreenUI(player, {}, playConfig))
}
})
But here are few problems I am facing now
1- I need to find an Event which I can use to make this condition trigger, so for now I tried with PlayerEvent.Playing it works when I pause the video then it checks if ViewMode is Fullscreen or not and renders accordingly. But I need this condition to check as soon as I press the Fullscreen button so can you suggest me such an event if such event is available
2- I can see the dom elements for the small screen ui and fullscreen stacks up on each other and
duplicates components haven’t been released so maybe I can use UiManager.release() for the following issue correct me if I am wrong here
Edit- So for First scenario I just rendered the default small ui variant and then I made the event listener listen to Player.ViewModeChanged event
case PlayerVariationEnum.SMALL:
setUIManager(buildDefaultSmallScreenUI(player, {}, playConfig))
player.on(player.exports.PlayerEvent.ViewModeChanged, () => {
if (player.getViewMode() === ViewMode.Fullscreen) {
setUIManager(buildDefaultFullScreenUI(player, {}, playConfig))
} else {
setUIManager(buildDefaultSmallScreenUI(player, {}, playConfig))
}
})
break
For 2nd case I can see multiple elements created every time I change the screen to fullscreen and back
How can I delete these elements or not create duplicate elements in the first place when its already present.