0.0.7 • Published 2 years ago

player-preact-webpack-nd v0.0.7

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

Getting Started

About

This project is exclusively intended for official partners of > Audio Intakes (@audio-intakes) and is of no > use if you don't have the required API credentials.

Our Player component houses the result of a candidate answering all answers and completing the audio intake in our Recorder component (i.e. a submission). The candidate has answered certain questions in the Recorder component and your users can (re)view these answers in our Player component within your software. Each instance of the Player component consumes, amongst other properties, a unique submissionId. So each instance of our Player component represents a set of audio answers (including transcriptions) provided by a particular candidate (in a particular step in the process).

The audio of each answer can be played and the transcription of each answer can be read and updated (in case of obvious errors). In addition, your users can export the audio and transcriptions for reviewing and sharing purposes.

Example

Audio intake – 03 playing

Installation

  yarn add @audio-intakes/player

or

  npm install --save @audio-intakes/player

or

<head>
  ...
  <!-- Load the Player library in the HTML head tag of your page -->
  <script src="//components.audiointakes.com/player.js"></script>
  ...
</head>

Importing

ES6:

import "@audio-intakes/player";

CommonJS:

require("@audio-intakes/player");

Versions

Latest: 0.3.1

Usage

Authorization

To be able to use the Player application you are required to pass on a valid JWT bearer token. This token can be fetched using your api credentials (key and secret) provided by us. The token expires after one day but if the Player receives an expired token it will inform you with this feedback.

Endpoint

Development:

https://partner-api-development.onrender.com/v1/auth/login

Production:

https://partner-api-production.onrender.com/v1/auth/login

Headers

Content-Type application/json

Body

{
  "apiKey": "<YOUR_API_KEY>",
  "apiSecret": "<YOUR_API_SECRET>"
}

It's recommended that you store your API Key and API Secret in safe environment. You will be sent two sets of credentials: one for development and one for production.

Return

When you pass your credentials this endpoint will return a JWT bearer token with an issued at timestamp. The token expires after one day but if the Player receives an expired token it will inform you with this feedback.

{
  "accessToken": "<your_access_token>"
}

Example

For the container div the minimum required width is 320px and the minimum required height 180px. The Player will read these dimensions and if not sufficient update the UI with this message.

NPM

import "@audio-intakes/player";

function Demo() {
  return (
    <div id="player-container" style="min-width: 320px; min-height:180px">
      <audio-intakes-player-component
        token="<your_access_token>"
        customer="<a_valid_customer_id>"
        submission="<a_valid_submission_id>"
        language="en-gb"
        theme="dark"
      />
    </div>
  );
}

render(<Demo />);

CDN

When you have added the player script with the cdn you can add it like this:

<body>
  <div id="player-container" style="min-width: 320px; min-height:180px">
    <audio-intakes-player-component
      token="<your_token>"
      customer="<a_valid_customer_id>"
      submission="<a_valid_submission_id>"
      language="en-gb"
      theme="dark"
    />
  </div>
</body>

Arguments

ArgumentTypeDescriptionDefault value
token (required)StringJWT bearer tokenundefined
customer (required)StringA valid customer id to authorize the provided submissionIdundefined
submission (required)StringA valid submission id to fetch the right submissionundefined
theme (optional)StringA theme name (see available themes) that defines the colors of the application"light"
language (optional)StringA language locale (see available languages)The user's browser language if available, otherwise "en-gb"

Available languages

LanguageLocale
English"en-gb"
Dutch"nl"

Available themes

["light", "dark"]

Browser compatibility

IE Edge Firefox Chrome Safari Opera Safari on iOS Opera mini Android browser Opera mobile Chrome for Android Firefox for Android

Errors

API

Error (code)Description
Not found (404)Usually returned when the API doesn’t find the requested resource using its ID reference. In the case of the Player component this could either mean the customerId of the submissionId.
Unauthorized (401)Returned when either the JWT token in invalid/expired or if you are not authorized to fetch the required submission based on the provided customerId.
Internal service error (501)Our API experiences an internal error. We will get notified when this happens and we will do everything to get us back live as soon as possible.

Properties

ErrorDescription
Invalid tokenThe token is not provided, not of type string, not a JWT token or, the token is expired.
Invalid customerIdThe customerId is either not provided or not of type string.
Invalid submissionIdThe submissionId is either not provided or not of type string.
Invalid languageThe language is either not of type string or not (yet) supported by us. You can find the supported languages under the 'Available languages' section in this README.md.
Invalid themeThe theme is either not of type string or not (yet) supported by us. You can find the supported themes under the 'Available themes' section in this README.md.

Device

ErrorDescription
Insufficient sizeThe size of the element containing our Player component is not sufficient. Our player component requires a minimum width of 320px and a minimum height of 180px.
Unsupported browserThe device or browser is not supported by our Player component. You can find the list of supported browsers under the 'Browser compatibility' section in this README.md.

Troubleshooting

If you have any trouble understanding our documentation please feel free to contact us at:

Partner support: partners@audiointakes.com

or via our Slack channel:

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago