Renaming viblast.js
The location of viblast.js
is used by Viblast to determine the base URL for any other scripts that get loaded on demand by Viblast. Let's take a look at the following snippet:
<head>
<script src="http://mysite.com/static/js/lib/viblast/viblast.js"></script>
...
</head>
The base URL here is http://mysite.com/static/js/lib/viblast/
. It will be used for loading additional resources required by Viblast. For example, if the input media stream is encrypted, Viblast will automatically load http://mysite.com/static/js/lib/viblast/viblast.crypto.js
. This script takes care of decrypting the stream.
Should you need to rename viblast.js
or concatenate it with other javascript files, you have to explicitly specify the base URL to be used by Viblast. For instance:
<head>
<script src="http://mysite.com/static/js/myapp.js"></script> <!-- viblast.js is concatenated as part of myapp.js -->
</head>
<body>
<video src="//server/stream.m3u8" data-viblast-key="viblast-key" data-viblast-base-url="/static/js/viblast/" controls width="640"></video>
</body>
If the viblast.crypto.js
resource is needed, it will be loaded from /static/js/viblast/viblast.crypto.js
. The base-url
parameter is available since version 6.22
. Here is the equivalent code written using the JavaScript API:
<video id="player" controls width="640"></video>
<script>
viblast('#player').setup({
stream: '//server/stream.m3u8',
key: 'viblast-kye',
baseUrl: '/static/js/viblast/'
});
</script>
Why can't I concatenate all Viblast .js files into a single one?
All .js files apart from viblast.js
are loaded as web workers. Due to limitations in the web worker API, it's not trivial to pack the worker code inside viblast.js
, so currently Viblast does not support that feature. If this functionality is important to you, please leave us a message explaining your use case. We will keep you posted about our progress.
Minification breaks viblast.js
All viblast scripts have already been minified using Google's Clojure Compiler. Minifying them further will not reduce their size and may even break them.