SwanandMarathe / ti.youtube

Titanium Alloy Widget - YouTube

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Titanium" "Alloy" MIT Licence

ti.youtube

Titanium Alloy Widget - YouTube

Simply drop in this Widget and instantly access all the methods within the 'YoutTube IFrame Player API' inside your Android and iOS Applications.

Then add your own ListView, TableView, or any other Component and access any of the Methods (listed below).

iPhone Android

Requirement

  • Titanium SDK

Usage

  • Download the latest release of the widget.
  • Unzip the folder to your project under app/widgets/ti.appraise
  • Add the widget as a dependency to your app/config.json
  • Add the Widget to your .xml (View)
<Widget src="ti.youtube" id="tiYouTube" defaultVideoId="wgg5Tch0-Hs" />

NOTE: The Widget sample code (above) includes a value for the property 'defaultVideoId'. This allows you to define the deafult video to load. You can also include the Widget without this property and a Pre-Loader will be added for you automatically, like this:

<Widget src="ti.youtube" id="tiYouTube" />

Methods

NOTE: This utilizes the built-in YouTube Player Object API.

cueVideoById

Loads the specified video's thumbnail and prepares the player to play the video
{Object}

videoId       (*required*)  
startSeconds  (optional)  
endSeconds    (optional)  

loadVideoById

Loads and plays the specified video
{Object}

videoId       (*required*)  
startSeconds  (optional)  
endSeconds    (optional)  

playVideo

Plays the video (already loaded)

Examples

cueVideoById

$.tiYouTube.cueVideoById({videoId: "F7KHyH2TuhE"});

loadVideoById

$.tiYouTube.loadVideoById({videoId: "F7KHyH2TuhE"});

playVideo

$.tiYouTube.playVideo();

config.json

"dependencies": {
        "ti.youtube": "1.0"
    }

More Information: YouTube API Documentation

Author

License

MIT

About

Titanium Alloy Widget - YouTube

License:MIT License


Languages

Language:HTML 53.5%Language:JavaScript 46.5%