-1

I upload a video into my mysql database. i have the location of it.when i try to load that video dont work.

my angular code is given below.

  $scope.videoApi = function(id) {      
    $http({
      method: "POST",
      url: "http://192.168.1.16:8070/courseapi/getpdf",
      data: {
        'id_course': id
      }
    }).then(function mySucces(response) {
      alert("listapi" + response.data);
      $scope.videodata = response.data;
      //$scope.currentProjectUrl = $sce.trustAsResourceUrl($scope.videodata[0].course_Attachments);
        }, function myError(response) {
          $scope.message = response.statusText;
          console.log(response.statusText);
          alert("courseEnrolled");
        });
  }

from here i the path of the video

my html code

<iframe src="{{videodata}}" width="50%" height="400px" ></iframe>

but this not works;

please help me

luee
  • 65
  • 2
  • 9

2 Answers2

0

You need to use ng-src instead of src attribute in iframe . Hence remove double braces

<iframe ng-src="videodata" width="50%" height="400px" ></iframe>

For your reference: How to set an iframe src attribute from a variable in AngularJS

Community
  • 1
  • 1
Gopinath Shiva
  • 3,822
  • 5
  • 25
  • 48
0
$scope.videodata = $sce.trustAsResourceUrl("https://www.youtube.com/embed/XGSy3_Czz8k");

I think you need to give the url of video in iframe.and the iframe as

  <iframe width="420" height="315" src="{{videodata}}">
  </iframe>
Nikhil Mohanan
  • 1,260
  • 1
  • 12
  • 23