NOT MAINTAINED - SHOULD NOT BE USED IN PRODUCTION This is a html-parser, use with caution. Your app could be suspended from appstores.
A util to extract raw video-URLs and format information from a YouTube-video page. This way you can play YouTube videos in the native video player.
The plugin is based on npm package youtube-parser
and adapted to the NativeScript framework (removed cli & excess dependencies).
Works on iOS and Android.
Run npm i nativescript-youtube-parser
in the ROOT directory of your project.
- url - 'watch video' page on YouTube.
- format - Object
{ quality: 'small | medium | high', container: 'mp4 | flv | 3pg | webm' }
- return value - A promise object to resolve with an array of URL/format info objects that match the requested format.
var youtubeParser = require('nativescript-youtube-parser');
youtubeParser.getURL('https://youtu.be/C_vqnySNhQ0', { quality: 'medium', container: 'mp4' })
.then(function (urlList) {
console.log("YouTube mp4 video url: ", urlList[0].url);
}
);
2.0.1
- Fixed issue with common.js include
2.0.0
- Code refactor, api-changes
1.1.0
- Fixed an https issue on Android that would cause the plugin not to work
1.0.0
- Initial release