0

I am trying to set the video source from the controller. If I hard coded the source everything works fine. But if I try to set it in the server doesn't work.

<video id="myVideo"  style="width:100%">
<source src="../../../../Content/Videos/{{$ctrl.videoSource}}"> - Doesn'tWork
<source src="../../../../Content/Videos/Test1.mp4">

self.videoSource = data.videoLink;

2 Answers2

0

You should be able to use the ng-src attribute on the <video> tag.

I know there used to be a bug in AngularJS where ng-src didn't work for <video> tags. If that is still the case, you can always write a custom filter to trust the URL. See: HTML5 Video is not working with AngularJS ng-src tag

Community
  • 1
  • 1
Ben
  • 2,441
  • 1
  • 12
  • 16
0

try this :

ng-src="$ctrl.getSource()"

and

in controller :

getSource() { return '../../../../Content/Videos/' + this.videoSource; }
binariedMe
  • 4,309
  • 1
  • 18
  • 34