I am creating an online course application and storing the video on YouTube. When a user clicks on courses then They should see the embedded YouTube videos. However It just creates the video frame and video doesn't play.
Here is my angular controller code. courses.client.controller.js
(function() {
'use strict';
angular
.module('courses')
.controller('CoursesController', CoursesController);
CoursesController.$inject = ['$scope', 'courseResolve', 'Authentication', '$sce'];
function CoursesController($scope, course, Authentication, $sce, $timeout) {
var vm = this;
vm.course = course;
vm.authentication = Authentication;
$scope.params = {
videoUrl: $sce.trustAsResourceUrl('https://youtube.com/embed/gZNm7L96pfY')
};
}
}());
Here is my html code. view-course.client.view.html. I have tried to two different approaches. Both Failed.
<section>
<div class="page-header">
<h1 ng-bind="vm.course.title"></h1>
</div>
<small>
<em class="text-muted">
Posted on
<span ng-bind="vm.course.created | date:'mediumDate'"></span>
by
<span ng-if="vm.course.user" ng-bind="vm.course.user.displayName"></span>
<span ng-if="!vm.course.user">Deleted User</span>
</em>
</small>
<p class="lead" ng-bind="vm.course.content"></p>
<div>
<video id="movie", ng-src="{{vm.course.courseLecture}}" width="500", height="300" controls>
</video>
<br><br><br>
<video style="width:300px;height:240px" controls preload="none" >
<source ng-src="{{params.videoUrl}}" type="video/mp4">
</video>
<br><br>
<hr>
<a ng-href="{{vm.course.courseLecture}}" target="_blank" >link1</a>
<hr>
<p class="lead" ng-bind="vm.course.courseLecture"></p>
</div>
</section>
Please let me know, where I am going wrong here.