1.4.2 • Published 19 days ago

@millicast/vue-viewer-plugin v1.4.2

Weekly downloads
-
License
See in LICENSE fi...
Repository
github
Last release
19 days ago

Millicast Vue.js Web Viewer Plugin

npm (scoped)

A Vue.js plugin to embed a Millicast player into your app. This plugin allows developers to simplify the integration of Millicast services into their own Vue.js apps.

Installation

To add this library to your project, from the command line execute the following instruction:

npm install @millicast/vue-viewer-plugin

or if you use Yarn

yarn add @millicast/vue-viewer-plugin

Basic Usage

To import the plugin into your Vue application, have the following structure in your main.js file:

import { createApp } from 'vue'
import App from './App.vue'
// import the plugin
import VideoPlayer from "@millicast/vue-viewer-plugin"

const  Vue = createApp(App)

// install within your app
Vue.use(VideoPlayer, {})

Vue.mount('#app')

You can either include the following dependecy at the end of your App.vue file:

<style>
    @import "@millicast/vue-viewer-plugin/dist/millicast-vue-viewer-plugin.css";
</style>

Or add the following dependecy at the beginning of your main.js file:

import "@millicast/vue-viewer-plugin/dist/millicast-vue-viewer-plugin.css"

You can now use the plugin in any Vue file of your project as a component.

Configuration Parameters

NameTypeAttributeDefaultDescription
accountIdStringMandatoryMillicast existing Account ID where you want to get the stream.
streamNameStringMandatoryMillicast existing Stream Name where you want to get the stream.
imageStringOptionalPlaceholder image while stream is offline. By default it is a solid black.
mutedBooleanOptionalfalseThe streaming will start muted.
autoplayBooleanOptionaltrueThe streaming will autoplay when connected.
hideButtonsArray.<String>Optional[]Specify a list of buttons to hide. See the hide buttons section for details.
reportUrlStringOptionalnullConfigure the URL to which reports should be sent to.
chromecastIdStringOptionalnullThe Chromecast ID of your application.
multisourceBooleanOptionalfalseConfigure your stream to show multiple streams.
noDelayBooleanOptionalfalseSets the minimum and maximum delay (sets forcePlayoutDelayMin and forcePlayoutDelayMax to 0).
showLabelsBooleanOptionaltrueShow stream label in multiview mode.
environmentObjectOptional.env file contentPlugin environment. See Environment options on how to configure.
mainLabelStringOptionalAllows to change the label of the main video.
startingQualityStringOptionalnullAllows to start the stream at a specific resolution when available. Possible values: 'High', 'Medium', 'Low', specifying the desired frame height (i.e. 360).
hideToastStringOptionalnullAllows to hide a specific type of toast notification. To hide multiple toast types, separate them using ,. Possible values: success, error, warning, info.
audioFollowsVideoBooleanOptionalfalseAllows automatically switching the audio to the one associated with the selected video source.

To be able to use the viewer, just reference the VideoPlayer component, and pass the parameters of your choice as an object in the parameter paramsOptions. Refer to the example usage.

hideButtons options

You can choose to show or hide certain buttons in the player in order to customize your experience.

OptionDescription
playHides the play button.
volumeHides the volume button.
pipHides the button that allows the small reproduction (picture-in-picture mode), in a corner of the window.
fullscreenHides the fullscreen button.
liveBadgeHides the message that indicates whether the stream is live or not.
userCountHides the number of concurrent viewers of the stream.
settingsHides the settings button.

In case you want to disable all buttons at once, you can simply pass the controls: false paremeter, instead of using hideButtons.

Environment options

You are able to set up the following environment settings. You can refer to .env.sample as a starting point.

OptiontypeDescription
NODE_ENVproduction \| developmentDetermines if the main app is a production or development build.
VUE_APP_TURN_ENDPOINTurl: stringSets the turn endpoint.
VUE_APP_LIVEWS_ENDPOINTurl: stringSets the live views endpoint.
VUE_APP_DIRECTOR_ENDPOINTurl: stringSets the director endpoint.
VUE_APP_PUBLIC_PATHurl: stringSets the public path endpoint.
VUE_APP_REPORT_URLurl: stringThe report playback URL.
VUE_APP_CHROMECAST_IDurl: stringChromecast ID of your application.

In case these parameters are not sent as a property, the plugin will use the default values specified in the .env file.

Example of Use

<VideoPlayer :paramsOptions="{accountId: '...', streamName: '...', autoplay: false, hideButtons: ['liveBadge'] }" />
  • Remember that accountId and streamName are the only requeried parameters.
  • At the moment, this plugin allows only one instance of the component at a time in a project.

Example Apps

Live Chat Example

An example app is also provided which integrates PubNub based live chat. You can find this example in the examples/live-chat folder.

To set your private PubNub & Dolby.io credentials, create a .env file in the root of your project directory. An example of this may be found in the examples/live-chat/.env.sample. More information on how to obtain your Dolby.io streaming credentials is available on the Dolby.io Streaming Docs page.

In order to run this example app, execute the following commands:

cd examples/live-chat
npm install
npm run serve

This will install the dependencies and run the app.

Plugin Test App

An example of an interactive and resizable sample app using the vue viewer plugin can be found in the examples/plugin-test folder. This app is for testing purposes.

Contribute

To develop and contribute to this project, refer to the instructions on how to set up your environment to start contributing here.

License

Please refer to LICENSE file.