UNPKG

videogular2

Version:

Videogular is a video application framework for desktop and mobile powered by Angular 2.0

842 lines (358 loc) 23 kB
<!DOCTYPE HTML> <html lang="" > <head> <meta charset="UTF-8"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <title>Getting Started · GitBook</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="description" content=""> <meta name="generator" content="GitBook 3.2.2"> <link rel="stylesheet" href="../gitbook/style.css"> <link rel="stylesheet" href="../gitbook/gitbook-plugin-responsive-iframes/plugin.css"> <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css"> <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css"> <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css"> <meta name="HandheldFriendly" content="true"/> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png"> <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon"> <link rel="next" href="how-videogular-works.html" /> <link rel="prev" href="../" /> </head> <body> <div class="book"> <div class="book-summary"> <div id="book-search-input" role="search"> <input type="text" placeholder="Type to search" /> </div> <nav role="navigation"> <ul class="summary"> <li class="header">Introduction</li> <li class="chapter " data-level="1.1" data-path="../"> <a href="../"> What's Videogular? </a> </li> <li class="header">Getting Started</li> <li class="chapter active" data-level="2.1" data-path="./"> <a href="./"> Getting Started </a> </li> <li class="chapter " data-level="2.2" data-path="how-videogular-works.html"> <a href="how-videogular-works.html"> How Videogular works </a> </li> <li class="chapter " data-level="2.3" data-path="master-media.html"> <a href="master-media.html"> Master Media </a> </li> <li class="chapter " data-level="2.4" data-path="using-the-api.html"> <a href="using-the-api.html"> Using the API </a> </li> <li class="header">Modules</li> <li class="chapter " data-level="3.1" data-path="../modules/core/"> <a href="../modules/core/"> videogular2/core </a> <ul class="articles"> <li class="chapter " data-level="3.1.1" data-path="../modules/core/vg-player/"> <a href="../modules/core/vg-player/"> VgPlayer </a> </li> <li class="chapter " data-level="3.1.2" data-path="../modules/core/vg-media/"> <a href="../modules/core/vg-media/"> VgMedia </a> </li> <li class="chapter " data-level="3.1.3" data-path="../modules/core/services/vg-api/"> <a href="../modules/core/services/vg-api/"> VgAPI </a> </li> <li class="chapter " data-level="3.1.4" data-path="../modules/core/services/vg-fullscreen-api/"> <a href="../modules/core/services/vg-fullscreen-api/"> VgFullscreenAPI </a> </li> <li class="chapter " data-level="3.1.5" data-path="../modules/core/services/vg-utils/"> <a href="../modules/core/services/vg-utils/"> VgUtils </a> </li> <li class="chapter " data-level="3.1.6" data-path="../modules/core/services/vg-controls-hidden/"> <a href="../modules/core/services/vg-controls-hidden/"> VgControlsHidden </a> </li> <li class="chapter " data-level="3.1.7" data-path="../modules/core/vg-cue-points/"> <a href="../modules/core/vg-cue-points/"> VgCuePoints </a> </li> <li class="chapter " data-level="3.1.8" data-path="../modules/core/events/"> <a href="../modules/core/events/"> VgEvents </a> </li> <li class="chapter " data-level="3.1.9" data-path="../modules/core/states/"> <a href="../modules/core/states/"> VgStates </a> </li> </ul> </li> <li class="chapter " data-level="3.2" data-path="../modules/buffering/"> <a href="../modules/buffering/"> videogular2/buffering </a> <ul class="articles"> <li class="chapter " data-level="3.2.1" data-path="../modules/buffering/vg-buffering/"> <a href="../modules/buffering/vg-buffering/"> VgBuffering </a> </li> </ul> </li> <li class="chapter " data-level="3.3" data-path="../modules/controls/"> <a href="../modules/controls/"> videogular2/controls </a> <ul class="articles"> <li class="chapter " data-level="3.3.1" data-path="../modules/controls/vg-controls/"> <a href="../modules/controls/vg-controls/"> VgControls </a> </li> <li class="chapter " data-level="3.3.2" data-path="../modules/controls/vg-play-pause/"> <a href="../modules/controls/vg-play-pause/"> VgPlayPause </a> </li> <li class="chapter " data-level="3.3.3" data-path="../modules/controls/vg-playback/"> <a href="../modules/controls/vg-playback/"> VgPlaybackButton </a> </li> <li class="chapter " data-level="3.3.4" data-path="../modules/controls/vg-scrub-bar/"> <a href="../modules/controls/vg-scrub-bar/"> VgScrubBar </a> <ul class="articles"> <li class="chapter " data-level="3.3.4.1" data-path="../modules/controls/vg-scrub-bar/vg-scrub-bar-current-time/"> <a href="../modules/controls/vg-scrub-bar/vg-scrub-bar-current-time/"> VgScrubBarCurrentTime </a> </li> <li class="chapter " data-level="3.3.4.2" data-path="../modules/controls/vg-scrub-bar/vg-scrub-bar-buffering-time/"> <a href="../modules/controls/vg-scrub-bar/vg-scrub-bar-buffering-time/"> VgScrubBarBufferingTime </a> </li> <li class="chapter " data-level="3.3.4.3" data-path="../modules/controls/vg-scrub-bar/vg-scrub-bar-cue-points/"> <a href="../modules/controls/vg-scrub-bar/vg-scrub-bar-cue-points/"> VgScrubBarCuePoints </a> </li> </ul> </li> <li class="chapter " data-level="3.3.5" data-path="../modules/controls/vg-time-display/"> <a href="../modules/controls/vg-time-display/"> VgTimeDisplay </a> <ul class="articles"> <li class="chapter " data-level="3.3.5.1" data-path="../modules/controls/vg-time-display/vg-utc.html"> <a href="../modules/controls/vg-time-display/vg-utc.html"> VgUtcPipe </a> </li> </ul> </li> <li class="chapter " data-level="3.3.6" data-path="../modules/controls/vg-track-selector/"> <a href="../modules/controls/vg-track-selector/"> VgTrackSelector </a> </li> <li class="chapter " data-level="3.3.7" data-path="../modules/controls/vg-mute/"> <a href="../modules/controls/vg-mute/"> VgMute </a> </li> <li class="chapter " data-level="3.3.8" data-path="../modules/controls/vg-volume/"> <a href="../modules/controls/vg-volume/"> VgVolume </a> </li> <li class="chapter " data-level="3.3.9" data-path="../modules/controls/vg-fullscreen/"> <a href="../modules/controls/vg-fullscreen/"> VgFullscreen </a> </li> </ul> </li> <li class="chapter " data-level="3.4" data-path="../modules/ima-ads/"> <a href="../modules/ima-ads/"> videogular2/ima-ads </a> <ul class="articles"> <li class="chapter " data-level="3.4.1" data-path="../modules/ima-ads/vg-ima-ads/"> <a href="../modules/ima-ads/vg-ima-ads/"> VgImaAds </a> </li> </ul> </li> <li class="chapter " data-level="3.5" data-path="../modules/overlay-play/"> <a href="../modules/overlay-play/"> videogular2/overlay-play </a> <ul class="articles"> <li class="chapter " data-level="3.5.1" data-path="../modules/overlay-play/vg-overlay-play/"> <a href="../modules/overlay-play/vg-overlay-play/"> VgOverlayPlay </a> </li> </ul> </li> <li class="chapter " data-level="3.6" data-path="../modules/streaming/"> <a href="../modules/streaming/"> videogular2/streaming </a> <ul class="articles"> <li class="chapter " data-level="3.6.1" data-path="../modules/streaming/vg-dash/"> <a href="../modules/streaming/vg-dash/"> VgDASH </a> </li> <li class="chapter " data-level="3.6.2" data-path="../modules/streaming/vg-hls/"> <a href="../modules/streaming/vg-hls/"> VgHLS </a> </li> </ul> </li> <li class="divider"></li> <li> <a href="https://www.gitbook.com" target="blank" class="gitbook-link"> Published with GitBook </a> </li> </ul> </nav> </div> <div class="book-body"> <div class="body-inner"> <div class="book-header" role="navigation"> <!-- Title --> <h1> <i class="fa fa-circle-o-notch fa-spin"></i> <a href=".." >Getting Started</a> </h1> </div> <div class="page-wrapper" tabindex="-1" role="main"> <div class="page-inner"> <div id="book-search-results"> <div class="search-noresults"> <section class="normal markdown-section"> <h3 id="getting-started">Getting Started</h3> <p>Create an Angular application with the <a href="">Angular CLI</a>:</p> <pre><code class="lang-bash">ng new single-media-player --style=scss </code></pre> <p>Now you can install the <code>videogular2</code> library and <code>core-js</code> typings:</p> <pre><code class="lang-bash">npm install videogular2 --save npm install @types/core-js --save-dev </code></pre> <h2 id="adding-the-icon-font">Adding the icon font</h2> <p>If you want to, you can use the official Videogular font to set icons on your buttons and controls. To do that you need to add a CSS on you <code>.angular-cli.json</code> file available on the root of your project.</p> <pre><code class="lang-json">{ ... <span class="hljs-string">&quot;apps&quot;</span>: [ { ... <span class="hljs-string">&quot;styles&quot;</span>: [ <span class="hljs-string">&quot;../node_modules/videogular2/fonts/videogular.css&quot;</span>, <span class="hljs-string">&quot;styles.scss&quot;</span> ], ... } ], ... } </code></pre> <p>If you want to set your own font and styles, you can set your custom css here or inside <code>styles.scss</code>.</p> <h2 id="updating-your-application-module">Updating your application module</h2> <p>To start using Videogular in your project you have to add the Videogular module to your application module.</p> <p>Open <code>src/app/app.module.ts</code> and remove the FormsModule and the HttpModule, we will not need that for this demo. This is how your <code>app.module.ts</code> file should like:</p> <pre><code class="lang-typescript"><span class="hljs-keyword">import</span> {NgModule} from <span class="hljs-string">&apos;@angular/core&apos;</span>; <span class="hljs-keyword">import</span> {BrowserModule} from <span class="hljs-string">&apos;@angular/platform-browser&apos;</span>; <span class="hljs-keyword">import</span> {VgCoreModule} from <span class="hljs-string">&apos;videogular2/core&apos;</span>; <span class="hljs-keyword">import</span> {VgControlsModule} from <span class="hljs-string">&apos;videogular2/controls&apos;</span>; <span class="hljs-keyword">import</span> {VgOverlayPlayModule} from <span class="hljs-string">&apos;videogular2/overlay-play&apos;</span>; <span class="hljs-keyword">import</span> {VgBufferingModule} from <span class="hljs-string">&apos;videogular2/buffering&apos;</span>; <span class="hljs-keyword">import</span> {SingleMediaPlayer} from <span class="hljs-string">&apos;./single-media-player&apos;</span>; @NgModule({ declarations: [SingleMediaPlayer], imports: [ BrowserModule, VgCoreModule, VgControlsModule, VgOverlayPlayModule, VgBufferingModule ], providers: [], bootstrap: [SingleMediaPlayer] }) <span class="hljs-keyword">export</span> <span class="hljs-keyword">class</span> AppModule { } </code></pre> <p>Now we&apos;re ready to start creating our video player.</p> <p>In the next section we will see how to create our very first video player!</p> <p><a href="how-videogular-works.html">Go to How Videogular Works</a></p> </section> </div> <div class="search-results"> <div class="has-results"> <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1> <ul class="search-results-list"></ul> </div> <div class="no-results"> <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1> </div> </div> </div> </div> </div> </div> <a href="../" class="navigation navigation-prev " aria-label="Previous page: What's Videogular?"> <i class="fa fa-angle-left"></i> </a> <a href="how-videogular-works.html" class="navigation navigation-next " aria-label="Next page: How Videogular works"> <i class="fa fa-angle-right"></i> </a> </div> <script> var gitbook = gitbook || []; gitbook.push(function() { gitbook.page.hasChanged({"page":{"title":"Getting Started","level":"2.1","depth":1,"next":{"title":"How Videogular works","level":"2.2","depth":1,"path":"getting-started/how-videogular-works.md","ref":"getting-started/how-videogular-works.md","articles":[]},"previous":{"title":"What's Videogular?","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["ga","responsive-iframes"],"pluginsConfig":{"ga":{"configuration":"auto","token":"UA-45418240-1"},"responsive-iframes":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"getting-started/README.md","mtime":"2017-06-22T07:43:44.601Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-06-22T07:45:27.174Z"},"basePath":"..","book":{"language":""}}); }); </script> </div> <script src="../gitbook/gitbook.js"></script> <script src="../gitbook/theme.js"></script> <script src="../gitbook/gitbook-plugin-ga/plugin.js"></script> <script src="../gitbook/gitbook-plugin-responsive-iframes/plugin.js"></script> <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script> <script src="../gitbook/gitbook-plugin-search/search.js"></script> <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script> <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script> <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script> <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script> </body> </html>