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).
- Titanium SDK
- 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" />
NOTE: This utilizes the built-in YouTube Player Object API.
Loads the specified video's thumbnail and prepares the player to play the video
{Object}
videoId (*required*)
startSeconds (optional)
endSeconds (optional)
Loads and plays the specified video
{Object}
videoId (*required*)
startSeconds (optional)
endSeconds (optional)
Plays the video (already loaded)
$.tiYouTube.cueVideoById({videoId: "F7KHyH2TuhE"});
$.tiYouTube.loadVideoById({videoId: "F7KHyH2TuhE"});
$.tiYouTube.playVideo();
"dependencies": {
"ti.youtube": "1.0"
}
More Information: YouTube API Documentation
- Adam Armstrong (@adamtarmstrong)
MIT