Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android11 Support Added #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-youtube-video-player",
"version": "2.4.0",
"version": "2.4.2",
"description": "**Play Youtube Videos in a native Video Player on Android & iOS.**",
"main": "index.js",
"scripts": {
Expand Down
5 changes: 3 additions & 2 deletions platforms/android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="adjustPan" package="com.bunkerpalace.YoutubVideoPlayerProject" xmlns:android="http://schemas.android.com/apk/res/android">
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="adjustPan" package="com.bunkerpalace.YoutubVideoPlayerProject"
xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
Expand All @@ -10,7 +11,7 @@
</intent-filter>
</activity>
<activity android:name="com.keyes.youtube.OpenYouTubePlayerActivity" android:screenOrientation="unspecified" />
<activity android:name="com.bunkerpalace.cordova.YouTubeActivity" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize"/>
<activity android:name="com.bunkerpalace.cordova.YouTubeActivity" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize"/>
</application>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private Intent createYoutubeIntent(String videoId) {
if(YouTubeIntents.canResolvePlayVideoIntentWithOptions(cordovaContext)){
intent = YouTubeIntents.createPlayVideoIntentWithOptions(cordovaContext, videoId, true, true);
} else {
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=" + videoId), cordovaContext, YouTubeActivity.class);
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube-nocookie.com/embed/" + videoId), cordovaContext, YouTubeActivity.class);
intent.putExtra("videoId", videoId);
ConfigXmlParser parser = new ConfigXmlParser();
parser.parse(cordovaContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

#import <Cordova/CDV.h>
#import "XCDYouTubeVideoPlayerViewController.h"
#import <XCDYouTubeKit/XCDYouTubeVideoPlayerViewController.h>

@interface YoutubeVideoPlayer : CDVPlugin {
NSString* _eventsCallbackId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,21 @@
//

#import "YoutubeVideoPlayer.h"
#import "XCDYouTubeKit.h"
#import <XCDYouTubeKit/XCDYouTubeKit.h>
#import <AVKit/AVKit.h>
#import <Cordova/NSDictionary+CordovaPreferences.h>

@implementation YoutubeVideoPlayer

- (void)pluginInitialize
{
NSString *api_key = [self.commandDelegate.settings cordovaSettingForKey:@"YouTubeDataApiKey"];

if (api_key != nil) {
[XCDYouTubeClient setInnertubeApiKey: api_key];
}
}

- (void)openVideo:(CDVInvokedUrlCommand*)command
{

Expand Down
120 changes: 63 additions & 57 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<plugin xmlns="http://cordova.apache.org/ns/plugins/1.0" id="cordova-plugin-youtube-video-player" version="2.4.0">
<plugin xmlns="http://cordova.apache.org/ns/plugins/1.0" id="cordova-plugin-youtube-video-player" version="2.4.1">

<name>CordovaYoutubeVideoPlayer</name>

Expand All @@ -12,59 +12,65 @@

<engines>
<engine name="cordova" version=">=3.0.0" />
</engines>

<js-module src="plugins/com.bunkerpalace.cordova.YoutubeVideoPlayer/www/YoutubeVideoPlayer.js" name="YoutubeVideoPlayer">
<clobbers target="YoutubeVideoPlayer"/>
</js-module>

<platform name="android">

<config-file target="res/xml/config.xml" parent="widget">
<feature name="YoutubeVideoPlayer">
<param name="android-package" value="com.bunkerpalace.cordova.YoutubeVideoPlayer"/>
</feature>
</config-file>

<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
</config-file>

<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:name="com.keyes.youtube.OpenYouTubePlayerActivity" android:screenOrientation="landscape"/>
<activity
android:name="com.bunkerpalace.cordova.YouTubeActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
android:label="@string/activity_name"
android:launchMode="singleTop"
android:theme="@android:style/Theme.Black.NoTitleBar"
android:windowSoftInputMode="adjustResize"/>
</config-file>

<source-file src="platforms/android/src/com/bunkerpalace/cordova/YouTubeActivity.java" target-dir="src/com/bunkerpalace/cordova"/>
<source-file src="platforms/android/src/com/bunkerpalace/cordova/YoutubeVideoPlayer.java" target-dir="src/com/bunkerpalace/cordova"/>
<lib-file src="platforms/android/libs/openyoutubeactivity.jar"/>
<lib-file src="platforms/android/libs/YouTubeAndroidPlayerApi.jar"/>

</platform>

<platform name="ios">

<config-file target="config.xml" parent="/*">
<feature name="YoutubeVideoPlayer">
<param name="ios-package" value="YoutubeVideoPlayer"/>
</feature>
</config-file>


<framework src="XCDYouTubeKit" type="podspec" spec="~> 2.7" />
<header-file src="platforms/ios/YoutubeVideoPlayerProject/Plugins/com.bunkerpalace.cordova.YoutubeVideoPlayer/YoutubeVideoPlayer.h"/>
<source-file src="platforms/ios/YoutubeVideoPlayerProject/Plugins/com.bunkerpalace.cordova.YoutubeVideoPlayer/YoutubeVideoPlayer.m"/>

<framework src="MediaPlayer.framework"/>
<framework src="AVFoundation.framework"/>
<framework src="JavaScriptCore.framework"/>

</platform>

</plugin>
</engines>

<js-module src="plugins/com.bunkerpalace.cordova.YoutubeVideoPlayer/www/YoutubeVideoPlayer.js" name="YoutubeVideoPlayer">
<clobbers target="YoutubeVideoPlayer"/>
</js-module>

<platform name="android">

<config-file target="res/xml/config.xml" parent="widget">
<feature name="YoutubeVideoPlayer">
<param name="android-package" value="com.bunkerpalace.cordova.YoutubeVideoPlayer"/>
</feature>
</config-file>

<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<queries>
<intent>
<action android:name="com.google.android.youtube.api.service.START" />
</intent>
</queries>
</config-file>

<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:name="com.keyes.youtube.OpenYouTubePlayerActivity" android:screenOrientation="landscape"/>
<activity android:name="com.bunkerpalace.cordova.YouTubeActivity" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize"/>
</config-file>

<source-file src="platforms/android/src/com/bunkerpalace/cordova/YouTubeActivity.java" target-dir="src/com/bunkerpalace/cordova"/>
<source-file src="platforms/android/src/com/bunkerpalace/cordova/YoutubeVideoPlayer.java" target-dir="src/com/bunkerpalace/cordova"/>
<lib-file src="platforms/android/libs/openyoutubeactivity.jar"/>
<lib-file src="platforms/android/libs/YouTubeAndroidPlayerApi.jar"/>

</platform>

<platform name="ios">

<config-file target="config.xml" parent="/*">
<feature name="YoutubeVideoPlayer">
<param name="ios-package" value="YoutubeVideoPlayer"/>
</feature>
</config-file>

<podspec>
<config>
<source url="https://github.com/CocoaPods/Specs.git"/>
</config>
<pods use-frameworks="true">
<pod name="XCDYouTubeKit" git="https://github.com/armendh/XCDYouTubeKit.git" branch="master"/>
</pods>
</podspec>

<header-file src="platforms/ios/YoutubeVideoPlayerProject/Plugins/com.bunkerpalace.cordova.YoutubeVideoPlayer/YoutubeVideoPlayer.h"/>
<source-file src="platforms/ios/YoutubeVideoPlayerProject/Plugins/com.bunkerpalace.cordova.YoutubeVideoPlayer/YoutubeVideoPlayer.m"/>

<framework src="MediaPlayer.framework"/>
<framework src="AVFoundation.framework"/>
<framework src="JavaScriptCore.framework"/>

</platform>

</plugin>