2.0.3 • Published 6 years ago

piksel v2.0.3

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

Piksel

An open source interface for embedding a piksel player on your page and interacting with its api. This simplifies the implementation process by abstraction.

  • NOTE: This documentation is incomplete and will be updated when the package has been developed a little more.

  • IMPORTANT: It's critical thatyou are using the HTML5 player in Piksel for the Javascript library to work. You can find this setting here: https://ovp.piksel.com/admin/projects/projectConfiguration.php If you are currently using the AppStudio Flash player, it is safe to upgrade the player to HTML5. You won't have to reembed your player. DOn't trust me though, test it first. ;) Beware too that when you save these settings that the Single Player is still selected in the General Settings sections at the bottom of the settings page. It has unselected itself on Update. If this happens the player will not load on the page.

Table of contents

Development

To get started developing, open this repo, run npm install on the main directory, then run npm start. This will start a webserver on the /examples folder. In the /examples/src/index.js file you'll find an instantiation of code in /src. Running the dev server also runs the production build script in parallel.

Visit http://localhost:9000/ in your browser and you should see an instance of the player (assuming the videoUUID in the /examples/src/index.js Piksel instance is valid.)

Deployment

To deploy, make sure you've been running with npm start or run npm run build. Once the project has built, it will build to the /lib folder, run npm run release or npm publish. Your local npm user must be the Olympusat npm account to publish.

Import

import { Piksel } from 'piksel';

Instantiate the player

Each instance of the player adds a new player to the DOM for you, in the specified wrapper element. The element must exist or the Piksel class will throw an error.

Instance Example
new Piksel({ 
    basePlayerUrl: "https://player.piksel.com",
    playerID: '1234_player_made_up_id', 
    videoUUID: [YOUR VIDEO ID HERE],  
    injectID: 'pikselPlayer',
    clientAPI: null,
    projectID: null,
    unmutedByDefault: true,
    de: {
      "color-default": 'f4c441',
      "color-hover": 'f46741',
      "googleads-disable" : true,
      start: '900',
      end: '930',
      volume: '100',
      autoplay: true, 
      width: '900px',    
      height: '600px'
    }
  })
  .then(pikselPlayer => {
    console.log("Wrapper Player Instance ", pikselPlayer);
    console.log("Piksel Player Instance ", pikselPlayer._player);

    document.body.addEventListener(`piksel__pikselPlayer`, e => {
      // console.log("EVT piksel__pikselPlayer ", e);
    });
  
    document.body.addEventListener(`piksel__playing`, e => {
      console.log("EVT piksel__playing ", e);
    });
  
    document.body.addEventListener(`piksel__volumechange`, e => {
      console.log("EVT piksel__volumechange ", e);
    });
  });

The above instance expect there to be a div on the DOM with an id of "pikselPlayer" before its instantiated.

<div id="pikselPlayer"></div>

Options

See this for a reference: https://faith.piksel.com/admin/help/PikselFaithHTML5/Content/Topics/Players/HTML_5_Player_Parameters/08PlayerParameters.htm

  • All props marked is legacy will be removed in the next major version (@3.0.0). You should use player de- property names inside the de object instead.
propertyis legacyValuesDescription
basePlayerUrlString urlUsually something like "https://player.piksel.com"
playerIDString
videoUUIDString
injectIDStringid of the element on the DOM that the player will be injected into.
clientAPI
projectID
startTimetrueString time in secondsVideo should begin playing at
endTimetrueString time in secondsVideo should end playing at
defaultVolumetrueStringMust be a string value 0-100 0=mute
unmutedByDefaultBoolean true/falsyMArked true, this will override Chrome's new autoplay only on mute default. It works by unmuting the video as soon as it receives a playing event.
addonUrlParamstrueString "de-googleads-disable=true&my-other-prop=false"A way to pass additional url params to the instantiating player. The de prop is the preferred way to do this in >v2
themetrue{}
theme.defaultControlsColortrueHex color
theme.defaultControlsHoverColortrueHex color
de{}The de object is the preferred way to pass de- props to the player instance. See Additional Options for available props. width, height, autoplay, etc. are all passed here. See the example. Instance Example

Methods

These exist on the player(wrapper) instance.

propertyValues
play
pause
getCurrentTime
setCurrentTimetime int in seconds
speedUp
speedDown
getCurrentRate
getCurrentVolume
mute
unmute
volumeUp
volumeDown

Events

There are two types of events that exist on the document.body element. 1. A player id based event that is fired anytime there is a player event. piksel__PLAYERID 2. A specific event that can be listened to, to reduce noise. piksel__EVENTNAME. See below for the event names.

Event NameDescription
playing
pause
seeking
seeked
timeupdateUse caution with this one. It fires every second.
volumechange
ended
error
loadstart
Event Examples
  document.body.addEventListener(`piksel__1234_player_made_up_id`, e => {
  });

  document.body.addEventListener(`piksel__playing`, e => {
  });

  document.body.addEventListener(`piksel__volumechange`, e => {
  });

Piksel Resources

After instantiating the player, you have access to the _player object on the instance. This _player prop contains the original player, made available in case you need extended interaction with the core player.

Here are the docs where you'll find info about what's available on the player. http://docs.videojs.com/docs/api/player.html

Examples from Piksel support

https://jsfiddle.net/yxt290L9/

https://jsfiddle.net/shaolintibo/wdt0Lko6/

https://jsfiddle.net/ujxes910/

https://jsfiddle.net/ym5eLb99/

Additional Options

Pass any of these parameters to the de object on the instance options, without the de- prefix.

Parameter NameDisplay Name in ConsoleDescriptionOptionsDefault Value
de-countdownEnable Countdown PluginEnables the countdown plugin.True/FalseTrue
de-cd-timerDEHTML5 Enable Countdown TimerEnables a countdown timer prior to the start of the live broadcast. The default is for the timer to be enabled. If you do not want a timer you will need to add this parameter with a False option.True/FalseTrue
de-cd-text-sizeCountdown Text SizeAllows you to set the text size of your countdown timer to 12 point, 14 point or 18 point size text.12, 14, 1812
de-cd-text-colorCountdown Text ColorAllows you to set the color of your countdown timer. Use the hex value of your chosen color to set the option.Hex value of colour.#FFFFFF
de-cd-text-weightCountdown Text WeightAllows you to display your timer in either normal or bold text.bold,normalnormal
de-cd-locationCountdown Text LocationAllows you to change the position of your countdown timer.top,middle,bottommiddle
de-cd-backgroundDEHTML5 Countdown Background ImageAllows you to add a background image to your countdown.Image
de-bumper-ratePre-Roll OccurancePre-roll can run before the countdown timer is shown, after the countdown nears the start of the live event, or both.Before Countdown, After Countdow, BothBefore Countdown
de-bumper-livePlay Pre-Roll for Late ViewersForce pre-roll to play for viewers who connect to the live event after it startedTrue/FalseFalse
de-event-completeDEHTML5 Event Completed MessageAllows you to change the default message that displays at the end of your live event.TextThank you for watching. The event has ended.
de-endOnDurationDEHTML5 End Live Stream Upon DurationTrue/False
de-dvr-windowDEHTML5 DVR Window (In Minutes)Number120
de-dvr-startDEHTML5 Start at Beginning of DVRTrue/FalseFalse
de-live-questionDEHTML5 Questionnaire form in playerEnables question form in live player to allow viewers to submit questions to a defined email location.True/FalseFalse
de-live-emailRecEmail recipientThe email address of the recipient of question forms in player. Requires DEHTML5 Questionnaire form in player to be enabled.Text
de-live-emailSubEmail SubjectSubject line text for emails from question form in player. Requires DEHTML5 Questionnaire form in player to be enabled.Text
de-series-uuidLive Series UUIDThe DE Live Series UUIDText
de-event-uuidLive Event UUIDThe DE Live Event UUIDText
2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.2.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.1

6 years ago