From 0cf7d6aca1df9ebafa45b5dc00acbd7d2fc2d063 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Sat, 27 Aug 2016 14:35:18 -0400 Subject: [PATCH] feat(youtube): add Youtube video player plugin support (#496) --- src/index.ts | 3 +++ src/plugins/youtube-video-player.ts | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/plugins/youtube-video-player.ts diff --git a/src/index.ts b/src/index.ts index c9cc4d5632..aac1fd5ae1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -103,6 +103,7 @@ import { Vibration } from './plugins/vibration'; import { VideoEditor } from './plugins/video-editor'; import { VideoPlayer } from './plugins/video-player'; import { WebIntent } from './plugins/webintent'; +import { YoutubeVideoPlayer } from './plugins/youtube-video-player'; import { Zip } from './plugins/zip'; export * from './plugins/3dtouch'; export * from './plugins/background-geolocation'; @@ -207,6 +208,7 @@ Transfer, TextToSpeech, Vibration, WebIntent, +YoutubeVideoPlayer, Zip } @@ -312,6 +314,7 @@ window['IonicNative'] = { VideoPlayer: VideoPlayer, Vibration: Vibration, WebIntent: WebIntent, + YoutubeVideoPlayer: YoutubeVideoPlayer, Zip: Zip }; diff --git a/src/plugins/youtube-video-player.ts b/src/plugins/youtube-video-player.ts new file mode 100644 index 0000000000..bf2ac46ffe --- /dev/null +++ b/src/plugins/youtube-video-player.ts @@ -0,0 +1,28 @@ +import {Plugin, Cordova} from './plugin'; +/** + * @name YoutubeVideoPlayer + * @description + * Plays YouTube videos in Native YouTube App + * + * @usage + * ``` + * import {YoutubeVideoPlayer} from 'ionic-native'; + * + * YouTubeVideoPlayer.openVideo('myvideoid'); + * + * ``` + */ +@Plugin({ + plugin: 'https://github.com/Glitchbone/CordovaYoutubeVideoPlayer.git', + pluginRef: 'YoutubeVideoPlayer', + repo: 'https://github.com/Glitchbone/CordovaYoutubeVideoPlayer', + platforms: ['Android', 'iOS'] +}) +export class YoutubeVideoPlayer { + /** + * Plays a YouTube video + * @param videoId {string} Video ID + */ + @Cordova({sync: true}) + static openVideo(videoId: string): void { } +}