I've hit a roadblock in my project and can't seem to figure out the issue.
The file I'm working on is supposed to display an iframe video player with a YouTube embed. I tried using interpolation to construct the correct URL:
<div class="video-player">
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" ng-src="{{'www.youtube.com/embed/' + $ctrl.video.id.videoId}}" allowFullScreen></iframe>
</div>
<div class="video-player-details">
<h3>{{$ctrl.video.snippet.title}}</h3>
<div>{{$ctrl.video.snippet.description}}</div>
</div>
</div>
However, each time I run my code, I encounter this error in the console:
angular.js:3626 GET http://127.0.0.1:56035/www.youtube.com/embed/OPxeCiy0RdY 404 (Not Found)
What's perplexing is that when I inspect the elements after running the program, it adds a #document property with additional HTML tags inside the iframe:
<iframe class="embed-responsive-item" ng-src="www.youtube.com/embed/OPxeCiy0RdY" allowfullscreen="" src="www.youtube.com/embed/OPxeCiy0RdY">
#document
<html><head></head><body>Cannot GET /www.youtube.com/embed/OPxeCiy0RdY
</body></html>
</iframe>
I'm trying to identify the root cause of this error and why the video isn't displaying in the player. I also have two other files, index.js and videoPlayer.js, which may be contributing to the problem:
index.js:
angular.module('video-player', [])
.config(function($sceDelegateProvider) {
$sceDelegateProvider.resourceUrlWhitelist([
'self',
'https://www.youtube.com/**',
'https://www.googleapis.com/youtube/v3/search'
])
});
And here's videoPlayer.js:
angular.module('video-player')
.component('videoPlayer', {
bindings: {
video: '<'
},
templateUrl: 'src/templates/videoPlayer.html'
});
If anyone can help me pinpoint where I might be going wrong, I would greatly appreciate it. I've exhausted all my troubleshooting efforts but can't seem to find the exact cause of the issue preventing the iframe from displaying.
PS: We utilize live-server
for our server