npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

videojs-schema

v0.8.0

Published

Injects JSON-LD metadata into the DOM for SEO

Downloads

131

Readme

videojs-schema

A plugin for the Brightcove Player to inject metadata from a Video Cloud video in to the page as Schema.org structured data. It uses the JSON-LD format supported by Google for video SEO, e.g.

<script type="application/ld+json">
{
  "@context":"http://schema.org/",
  "@type":"VideoObject",
  "name":"Big Buck Bunny",
  "description":"(c) copyright 2008, Blender Foundation / www.bigbuckbunny.org",
  "thumbnailUrl":"https://cf-images.eu-west-1.prod.boltdns.net/v1/static/906043040001/f7d56300-ffca-460d-8ff6-fef835c12b36/e284fdba-d15a-422f-bebc-6a355e3d4dd3/1280x720/match/image.jpg",
  "uploadDate":"2016-10-20",
  "@id":"http://players.brightcove.net/906043040001/5WnZb7ptr_default/index.html?videoId=ref:bunnyfull",
  "duration":"PT10M35S",
  "embedUrl":"http://players.brightcove.net/906043040001/5WnZb7ptr_default/index.html?videoId=1401169490001"
}
</script>

As seen by Google: https://search.google.com/structured-data/testing-tool/u/0/#url=http%3A%2F%2Fplayers.brightcove.net%2F906043040001%2F5WnZb7ptr_default%2Findex.html%3FvideoId%3Dref%3Abunnyfull

The embedUrl is only included if the social plugin is present and its removeEmbed option is not true.

Options

schemaId - the value to use as @id in the metadata. This must be a unique URI which represents the video, but not necessarily a "real" URL. This is arbitrary and might be a value like https://mydomain.com/videos/{id} or https://videos.mydomain.com#{id} or https://mydomain.com/article-about-video-{id}#the-video.

Accepts {id}, {referenceId}, {playerId}, {embedId} and {accountId} as macros.

Defaults to https://players.brightcove.net/{accountId}/{playerId}_{embedId}/index.html?videoId={id}

keywords - if true, include tags as keywords. Default is false.

excludeTags - array of tags to not include as keywords in the schema metadata, e.g. ["youtubesync"]

baseObject - an option object of properties onto which to build the video specific metadata. For example this could be used to include a publisher object:

includeEmbedUrl - if false, no embed url is included. Inlcuding thisURL may be expected by search engines. Default is true.

skipRules - used to exclude videos from having schema metadata generated, based on their video cloud metadata. Can be tags and / or custom fields. If multiple tags, fields or both are specified, matching any excludes.

skipRules.customFields - any object of field-value pairs. If a field present and set to the value in the video's custom fields, no schema metadata is created. e.g. {category: 'unlisted'}

skipRules.tags - any array of one or more tags. If any one is present in the video's metadata, no schema metadata is created. e.g. ['notthistag']

transcript - if true, a captions or subtitles track with a matching language will be added as a transcript. Default is false.

transcriptMatchAny - if true and transcript is also true, a transcript will be added from the first usable track, if there is no language match. Default is false.

"baseObject": {
  "publisher": {
    "@type": "Organization",
    "name": "Publisher name",
    "logo": {
      "@type": "ImageObject",
      "url": "https://example.com/logo.jpg",
      "width": 600,
      "height": 60
    }
  }
}

preferLongDescription - if true, use the long description if available. If false, or true and long description is not set then the (short) description field will be used. Default is false.

Description metadata

By default, the short description field is used as the description text. If the preferLongDescription option is set, the long description will be used instead, falling back to short description if empty. If the short description (or both long and short descriptions with preferLongDescription) is empty, then the title is used since no description is considered invlaid schema.

Install

Add as a plugin to a player in Video Cloud Studio:

  • Under "plugins" click "add a plugin", 'custom plugin"
  • Plugin name is schema
  • Javascript URL is https://cdn.jsdelivr.net/npm/videojs-schema/dist/videojs-schema.min.js
  • No CSS
  • Leave blank unless using options above, in which case
{
  "schemaId": "https://example.com/my/url/{id}"
}
  • Save, then publish