TypeError:无法读取属性' PERSISTENT'未定义的

时间:2016-03-18 09:33:54

标签: angularjs ionic-framework

我正在尝试播放有关离子的视频。当我启动我的应用程序时,我在控制台上遇到上述错误,该错误引用了这行代码

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem){

这是js文件的代码块

//Function for fetch video files from ionicrecorder folder from memory and set in list
    $scope.func = function(){
        //$rootScope.show('Accessing Videos.. Please wait');
        $window.requestFileSystem($window.LocalFileSystem.PERSISTENT, 0, function(fs) {

          fs.root.getDirectory('ionicrecorder', {create: true}, function(dirEntry){
                  var dirReader = dirEntry.createReader();
                  dirReader.readEntries(function(entries) {
                    if(entries.length === 0){
                      alert("No Videos available...");
                      $rootScope.hide();
                    }
                      var arr = [];
                      processEntries(entries, arr, function(arr) {
                        $scope.files = $scope.dup;
                        $rootScope.hide();
                      }); // arr is pass by refrence
                  }, onError);
                }, onError);

            //Error
                function onError(error) {
                    alert("Failed to list directory contents: " + error.code);
                }
        },
        function(error) {
          console.log(error);
        });
    }

============== EDITTED ===================== 我目前有错误

-master>cordova plugin add github.com/apache/cordova-plugin-file
Fetching plugin "github.com/apache/cordova-plugin-file" via plugin registry
npm ERR! addLocal Could not install github.com/apache/cordova-plugin-file
Error: ENOENT, stat 
on\IonicVideoRecorder-master\github.com\apache\cordova-plugin-file'
    at Error (native)

1 个答案:

答案 0 :(得分:0)

$window.requestFileSystem($window.PERSISTENT, 0, function (fs) {