i new angular js. have html5 video element src bind dynamically. src url of api call need auth token send along request. want send token along video request or before request. can send using angular.module run() ? please help.
<div> <video ng-app="previewvideo" id="videoplayer" src="" width="420" style="display: none;" type="video/mp4" class="video-js vjs-default-skin" controls> </video> </div> angular.module('previewvideo', []).run(function () { debugger; var _beforerequest = _.isfunction(videojs.hls.xhr.beforerequest); videojs.hls.xhr.beforerequest = function (options) { if (_beforerequest) { options = _beforerequest(options); } if (authtoken) { options.headers = options.headers || {}; options.headers.authorization = 'token ' + token; } return options; }; });
Comments
Post a Comment