Giter Site home page Giter Site logo

vrdriver / cordovayoutubevideoplayer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from christopherafbjur/cordovayoutubevideoplayer

2.0 0.0 0.0 2.92 MB

Play Youtube Videos in a native Video Player on Android & iOS

License: MIT License

Java 69.42% CSS 0.70% HTML 0.51% JavaScript 4.98% Batchfile 1.06% Objective-C 19.73% C 0.41% Shell 2.77% AppleScript 0.11% C++ 0.19% C# 0.13%

cordovayoutubevideoplayer's Introduction

Cordova YoutubeVideoPlayer Plugin

This has been updated to work for Ionic 6 as at 2022 April 25th.

I'm taking not credit for these changes, but needed to find a solution that was going to work for me. Others may find it helpful though.

You can read more of the process in getting to these updates here: https://stephenmonro.wordpress.com/2022/04/13/getting-youtube-videos-to-play-again-in-ionic5/

Specific updates for Ionic 6.

Installation - Updated for 2022

cordova plugin add https://github.com/vrdriver/CordovaYoutubeVideoPlayer

Simple Usage for Angular

The Usual imports for your module and ts files:

import { YoutubeVideoPlayer } from '@ionic-native/youtube-video-player/ngx';

The addition for your constructor:

constructor( public youtube:YoutubeVideoPlayer ) {}

Then, in your TS file, use this code to play a video:

this.youtube.openVideo('dQw4w9WgXcQ'); //opens video with videoId

Other information from the original fork

Play Youtube Videos in a native Video Player on Android & iOS. This fork works on Android 6, and does not force landscape mode on Android.

Original iOS plugin uses XCDYouTubeKit by Cédric Luthi:
https://github.com/0xced/XCDYouTubeKit

This repository now uses updated code at: https://github.com/vrdriver/XCDYouTubeKit

Android version (up to 4.4) uses OpenYoutubeActivity by Keyes Labs:
https://code.google.com/p/android-youtube-player

Android version (5.0+) uses YouTube Android Player API: https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubePlayer

Android with YouTube App Version 111662130 requires a workaround to resolve an App issue: https://code.google.com/p/gdata-issues/issues/detail?id=8244

Usage

YoutubeVideoPlayer.openVideo('YOUTUBE_VIDEO_ID', function(result) { console.log('YoutubeVideoPlayer result = ' + result); });

For Android 5.0+ you will need to add the following to config.xml

<preference name="YouTubeDataApiKey" value="[YOUR YOUTUBE API]" />

with your own YouTube Key.

If you are using Capacitor, you'll potentially get a gradle error that will leave after you open the project and gradle files are built. The other thing is that you may need to add the following line to your Android project: Android/local.properties:

YOUTUBE_API_KEY="YOUR_YOUTUBE_API_KEY"

For more information: https://developers.google.com/youtube/v3/getting-started

The callback is called when the video window is closed. (Work in Progress - should be working for IOS).

Original Authors

Adrien Glitchbone

d0cz

trakout

License

CordovaYoutubeVideoPlayer is available under the MIT license. See the LICENSE file for more information.
XCDYouTubeKit is available under the MIT license.
OpenYoutubeActivity is available under the Apache License 2.0.

cordovayoutubevideoplayer's People

Contributors

arctouch-brunowolff avatar axelcostaspena avatar christopherafbjur avatar davidgv88 avatar glitchbone avatar ihadeed avatar javierabrego avatar jonsmart avatar markdegrootnl avatar trakout avatar trinnguyen avatar vrdriver avatar zackexplosion avatar

Stargazers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.