<?xml version="1.0" encoding="UTF-8" ?>
<plugin xmlns="http://phonegap.com/ns/plugins/1.0"
        xmlns:android="http://schemas.android.com/apk/res/android"
        id="cordova-plugin-chromecast"
        version="2.3.6">
  <engines>
    <engine name="cordova" version=">=3.4.0" />
  </engines>

  <name>Cordova ChromeCast</name>

  <js-module src="www/chrome.cast.js" name="ChromecastApi">
    <clobbers target="chrome.cast" />
  </js-module>

  <js-module src="www/EventEmitter.js" name="EventEmitter"></js-module>

  <platform name="android">
    <config-file target="res/xml/config.xml" parent="/*">
      <feature name="Chromecast">
        <param name="android-package" value="acidhax.cordova.chromecast.Chromecast"/>
        <param name="onload" value="true" />
      </feature>
    </config-file>

    <config-file target="AndroidManifest.xml" parent="/*">
      <uses-permission android:name="android.permission.INTERNET" />
      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
      <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    </config-file>

    <config-file target="AndroidManifest.xml" parent="/manifest/application">
      <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
      <meta-data android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME" android:value="acidhax.cordova.chromecast.CastOptionsProvider" />
    </config-file>

    <framework src="com.google.android.gms:play-services-cast:19.0.0" />
    <framework src="com.google.android.gms:play-services-cast-framework:19.0.0" />
    <framework src="androidx.appcompat:appcompat:1.0.2" />
    <framework src="androidx.mediarouter:mediarouter:1.0.0" />

    <source-file src="src/android/CastOptionsProvider.java" target-dir="src/acidhax/cordova/chromecast" />
    <source-file src="src/android/Chromecast.java" target-dir="src/acidhax/cordova/chromecast" />
    <source-file src="src/android/ChromecastConnection.java" target-dir="src/acidhax/cordova/chromecast" />
    <source-file src="src/android/ChromecastSession.java" target-dir="src/acidhax/cordova/chromecast" />
    <source-file src="src/android/ChromecastUtilities.java" target-dir="src/acidhax/cordova/chromecast" />
  </platform>

  <platform name="ios">
    <config-file target="config.xml" parent="/*">
      <feature name="Chromecast">
        <param name="ios-package" value="MLPChromecast"/>
        <param name="onload" value="true" />
      </feature>
    </config-file>

    <podspec>
      <config>
        <source url="https://cdn.cocoapods.org/"/>
      </config>
      <pods use-frameworks="true">
        <pod name="google-cast-sdk" spec="~> 4.5.3" />
      </pods>
    </podspec>

    <header-file src="src/ios/MLPChromecast.h" />
    <source-file src="src/ios/MLPChromecast.m" />
    <header-file src="src/ios/MLPChromecastSession.h" />
    <source-file src="src/ios/MLPChromecastSession.m" />
    <header-file src="src/ios/MLPCastUtilities.h" />
    <source-file src="src/ios/MLPCastUtilities.m" />
    <header-file src="src/ios/MLPCastRequestDelegate.h" />
    <source-file src="src/ios/MLPCastRequestDelegate.m" />
  </platform>
</plugin>
