mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-13 19:29:37 +08:00
70c9558d2b
* refactor(YoutubeVideoPlayer): updated repo fix #1352 * Update index.ts * Update index.ts * Update index.ts
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
|
/**
|
|
* @name Youtube Video Player
|
|
* @description
|
|
* Plays YouTube videos in Native YouTube App
|
|
*
|
|
* @usage
|
|
* For Android 5.0+ you will need to add the following to config.xml
|
|
* ```xml
|
|
* <preference name="YouTubeDataApiKey" value="[YOUR YOUTUBE API]" />
|
|
* ```
|
|
* For more information: https://developers.google.com/youtube/v3/getting-started
|
|
*
|
|
*
|
|
* ```typescript
|
|
* import { YoutubeVideoPlayer } from '@ionic-native/youtube-video-player';
|
|
*
|
|
* constructor(private youtube: YoutubeVideoPlayer) { }
|
|
*
|
|
* ...
|
|
*
|
|
*
|
|
* this.youtube.openVideo('myvideoid');
|
|
*
|
|
* ```
|
|
*/
|
|
@Plugin({
|
|
pluginName: 'YoutubeVideoPlayer',
|
|
plugin: 'https://github.com/JonSmart/CordovaYoutubeVideoPlayer',
|
|
pluginRef: 'YoutubeVideoPlayer',
|
|
repo: 'https://github.com/JonSmart/CordovaYoutubeVideoPlayer',
|
|
platforms: ['Android', 'iOS']
|
|
})
|
|
@Injectable()
|
|
export class YoutubeVideoPlayer extends IonicNativePlugin {
|
|
/**
|
|
* Plays a YouTube video
|
|
* @param videoId {string} Video ID
|
|
*/
|
|
@Cordova({ sync: true })
|
|
openVideo(videoId: string): void { }
|
|
}
|