0

I am using below code to play video store on local machine but I am getting error in chrome like Not allowed to load local resource: file:/// while in Firefox web browser I am getting video format or MIME type is not supported.

    <video src="{{trainingVideoURL | trustAsResourceUrl}}"    width="500" height="300" style="margin-left:200px;" controls="controls" type="video/mp4">
</video>

Below is the controller where getting url

function loadPreReqs() {
        $scope.trainingVideoIdPk=$routeParams.trainingVideoIdPk;
        trainingFactory.getTrainingVideoPath($scope.trainingVideoIdPk).success(function(data) {         
            $scope.trainingVideoURL= data;
         }).error(function(error){
             alert(error.status);
         });
    }

filter with $sce to avoid blocking loading a resource from an insecure URL

.filter('trustAsResourceUrl', function ($sce) {
          return function(videoPath) {
            return $sce.trustAsResourceUrl('file://'+ videoPath);
          };

    });

and I am getting below error while trying to play video Not allowed to load local resource: file:///home/abc/project/Training/videos/Oral%20&%20Maxillofacial%20Surgery.mp4 in chrome

I tried other solution as well as suggested in this post Getting "Not allowed to load local resource" error while trying to attach a MediaSource object as the source of a HTML5 video tag

but got the error: GET http://home/abc/project/Training/videos/Oral%20&%20Maxillofacial%20Surgery.mp4 net::ERR_NAME_NOT_RESOLVED

SSC
  • 53
  • 1
  • 5

1 Answers1

-1

This may or may not be a valid answer for you, but I've heard of something similar with JS not being able to access a local resource in Google Chrome and what is mentioned here -

https://chrisbitting.com/2014/03/04/allow-local-file-access-in-chrome-windows/

fixed that specific issue. Chrome in some situations by default will not allow access from files being browsed (locally) to access the filesystem without the appropriate --allow-file-access-from-files flag. This means that unless you clean run chrome with that flag, no files that are run from the local system in Chrome will be able to access the local filesystem.

It's just a security feature of Google Chrome.

Like I say, might not resolve the issue but worth a shot :)

Jack Isaacs
  • 106
  • 1
  • 8