Error installing cordova plugins


#1

I have been able to install plugins in the past but now I am getting an error that says:

Failed to install ‘cordova-plugin-device’:CordovaError: The provided path “/Users/Username/Desktop/Project-Name/platforms/browser” is not a valid browser project.

I am using the adobe Phonegap build to run it on a device but now I am getting this same error whenever I run phonegap serve. I am using youtube Iframes and everything was showing up fine before with the $sceDelegateProvider but since the error I am just getting a blank Iframe. I have tried using $sce as well but my Iframes are still blank.

Two issues I guess but I’m not too sure if they are related. Any ideas on what could be causing this? Thank you in advance.


#2

I was able to fix the error by removing the browser platform with:

$ ionic platform rm browser

and then adding it back with:

$ ionic platform add browser

So that fixed the first error but my Iframes are still showing up blank when on a device.


#3

The code that I was using that used to work was:

<div class="video-container">
  <iframe ng-src="{{ 'https://www.youtube.com/embed/' + video.key }}" frameborder="0" allowfullscreen></iframe>
</div>

I used the css provided by @mhartington here and it worked perfectly.

In my .config:

$sceDelegateProvider.resourceUrlWhitelist([
    'self',
    'https://www*.youtube.com/embed/**'
   ]);
 })

That was my setup that was working for me but for some reason they are blank. Since then I have tried using http instead of https. I have also tried loading the video differently using $sce.trustAsResourceUrl provided by @mhartington here.

The way I used that goes as follows:

<div class="video-container">
   <iframe ng-src="{{ trustSrc(video.key) }}" frameborder="0" allowfullscreen></iframe>
</div>

and in my controller:

$scope.trustSrc = function(key) {
      return $sce.trustAsResourceUrl('http://www.youtube.com/embed/' + key);
  }

These have both worked fine in the browser but on a device it is just showing up as a blank white space. The iframe used to work fine on a device so I’m at a loss for what the problem could be. Is there anything else I should try to solve this problem?