Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/triniwiz/nativescript-youtubeplayer


https://github.com/triniwiz/nativescript-youtubeplayer

youtube youtube-player

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

# NativeScript YoutubePlayer

[![npm](https://img.shields.io/npm/v/nativescript-youtubeplayer.svg)](https://www.npmjs.com/package/nativescript-youtubeplayer)
[![npm](https://img.shields.io/npm/dt/nativescript-youtubeplayer.svg?label=npm%20downloads)](https://www.npmjs.com/package/nativescript-youtubeplayer)
[![Build Status](https://travis-ci.org//triniwiz/nativescript-youtubeplayer.svg?branch=master)](https://travis-ci.org/triniwiz/nativescript-youtubeplayer)

## Installation

#### [NativeScript 7+](https://github.com/triniwiz/nativescript-plugins)

* `ns plugin add @triniwiz/nativescript-youtubeplayer`

#### NativeScript 4x

* `tns plugin add nativescript-youtubeplayer`

#### NativeScript 3x

* `tns plugin add [email protected]`

# Configuration

### Android

Api key follow ➡
[link](https://developers.google.com/youtube/android/player/register) to get
your api key

# Usage

### XML
IMPORTANT: Make sure you include xmlns:ui="nativescript-youtubeplayer" on the
Page element

```xml

```

### Angular
```
import { YoutubePlayerModule } from 'nativescript-youtubeplayer/angular';

@NgModule({
imports: [
YoutubePlayerModule
],
declarations: [
AppComponent
],
bootstrap: [AppComponent]
})
```

```xml

```

### Vue
Register the plugin in `app.js` (or depending on your app's setup: `app.ts`, or `main.js`, etc):

```javascript
import Vue from 'nativescript-vue'
Vue.registerElement('YoutubePlayer', () => require('nativescript-youtubeplayer').YoutubePlayer)
```

```vue







```

# Api

| Method | Default | Type | Description |
| --- | --- | --- | ---|
| play() | | void | Starts video playback of the currently cued / loaded video. |
| stop() | | void | Stops and cancels loading of the current video. |
| destroy() | | void | Destroy the video player and free resources. |
| pause() | | void | Pauses the currently playing video. |
| isPlaying() | false | boolean | Returns is current video is playing. |
| toggleFullscreen() | | void | Toggle fullscreen mode. |

## Properties

| Property | Default | Type | Required | Description |
| --- | --- | --- | ---| ---|
| src | null | string |

  • - [x]
| Set the videoId to play e.g (Z0LWuKQcrUA) => https://www.youtube.com/watch?v=Z0LWuKQcrUA
| options | null | Object |
  • - [ ]
| Player options [available](https://developers.google.com/youtube/player_parameters) *IOS only*
| isFullScreen | false | boolean |
  • - [ ]
| Returns if player is currently in fullscreen mode.

## Example Image
| IOS | Android|
| --- | ---|
|![IOS](https://i.imgur.com/GqNqzMY.png) | ![Android](https://i.imgur.com/0jpewm2.png)|

# TODO

* [x] IOS
* [x] toggleFullscreen IOS