I’m working on a Spotify application that needs to embed YouTube videos using iframes. The implementation works perfectly when tested in regular web browsers, but I’m running into problems when trying to run it within the Spotify app environment.
The main issue is that I keep getting an error message inside the iframe that says Adobe Flash Player or HTML5 supported browser is required for video playback
. I’ve already installed Flash Player separately from Chrome, so I know it’s available on my system.
I’m wondering if there are specific configuration steps needed to enable Flash support in Spotify apps. Maybe there’s something I need to add to the manifest.json
file or other settings?
Here’s my video player implementation code:
var scriptElement = document.createElement('script');
scriptElement.src = "https://www.youtube.com/iframe_api";
var existingScript = document.getElementsByTagName('script')[0];
existingScript.parentNode.insertBefore(scriptElement, existingScript);
var videoPlayer;
function onYouTubeIframeAPIReady() {
videoPlayer = new YT.Player('video-container', {
height: '480',
width: '720',
videoId: 'dQw4w9WgXcQ',
events: {
'onReady': handlePlayerReady,
'onStateChange': handleStateChange
}
});
}
function handlePlayerReady(evt) {
evt.target.playVideo();
}
var hasPlayed = false;
function handleStateChange(evt) {
if (evt.data == YT.PlayerState.PLAYING && !hasPlayed) {
hasPlayed = true;
}
}
function pauseVideo() {
videoPlayer.pauseVideo();
}
Any help would be appreciated!