1.1.0-canary.0 • Published 2 days ago

playcraft-google-cast v1.1.0-canary.0

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
2 days ago

Playcraft

Enjoy our latest update where we have fixed some bugs and improved our framework to provide you more stable playbacking experience.

Playcraft wraps the logic of requesting video and verifying authorization, it also provides a control panel with basic control of playback, such like play, pause, seek ...etc.

This library is for developing a CAF-SDK-based chromecast receiver application.

Get Started

Copy entire content of sample/ to project folder, run these commands to install packages, start development server and open sample app in a new browser tab.

yarn
yarn dev

To run the app in a receiver device(Chromecast), register a new receiver app id with URL to the local network IP, and cast from a sender with that id.

virtual-cast is recommended for receiver app development.

How does the Receiver Working

Please read CAF Receiver Overview first.

Queuing

Changing to next / previous episodes and autoplay next are managed by CAF.

When start playing a video, the receiver will set queue items by CAF QueueManager, and CAF will play next / previous episode from the queue.

Note: QueueManager instance can be get by cast.framework.CastReceiverContext.getInstance().getPlayerManager().getQueueManager().

Sync with Senders

Load & Play Media

Sender request receiver to play a media by sending a load request, containing manifest URL (and DRM license server URL for protected stream).

Web sender example

cast.framework.CastContext.getInstance().loadMedia(
  new chrome.cast.media.LoadRequest(
    Object.assign(
      new chrome.cast.media.MediaInfo('https://video-cdn.com/stream.mpd'),
      {
        customData: {
          drm: {
            licenseUrl: 'https://license.server/portal'
          }
        }
        metadata: new chrome.cast.media.GenericMediaMetadata()
      }
    )
  )
)

Report Media Information

After casting media to the receiver, current playing media information will be reported to the sender continuously, so that the sender can update UI for episode / linear program change.

MediaInformation: {
  ContentID,
    customData: {
      itemType,
      mediaSource,
      title,
      subtitle,
      images,
      startTime,
      endTime
    }
}

Plugins

While this library provides common used features, some features are not required in all use cases, these features are implemented as plguins.

Design

  • Good default features and behaviors should be provided without options / config, so that common uses cases are easy to implement.
  • Advanced and special features should be implemented as plugins, isloated from playback core and other features, to make the library easy to scale up in terms of adding features.
  • Share more code from web playback module

API Reference

  • startApp is for core player with basic functionalities

startApp

Start basic player with customized UI & DRM suppport.

import {startApp} from 'playcraft-google-cast/core'

startApp({
  ui: {
    toast: document.querySelector('#toast'),
    debugPanel: document.querySelector('#debug'),
  },
  plugins: [],
})
1.3.5

2 days ago

1.3.4

30 days ago

1.3.3

4 months ago

1.3.2

4 months ago

1.3.1

4 months ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.0

2 years ago

1.2.0-canary.3

1 year ago

1.2.0-canary.2

2 years ago

1.2.0-canary.1

2 years ago

1.2.0-canary.0

2 years ago

1.1.0-canary.1

2 years ago

1.2.2

1 year ago

1.2.1

1 year ago

1.1.0-canary.0

2 years ago