• Stars
    star
    2,501
  • Rank 18,363 (Top 0.4 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 5 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A React-based web video player

A React-based Web video player

License npm package Coverage Status Code style PRs Welcome

English | 简体中文 | 日本語

Introduction

  • Streaming: Griffith makes streaming easy. Whether your video format is mp4 or hls, Griffith can use Media Source Extension (MSE) for segment loading.
  • Extensibility: Griffith makes it simple to support video features in React apps. It also supports the UMD (Universal Module Definition) patterns for direct use in the browser if your application is not based on React.
  • Reliability: Griffith has been widely used in the web and mobile web of Zhihu.

Usage

React application

yarn add griffith
import Player from 'griffith'

const sources = {
  hd: {
    play_url: 'https://zhstatic.zhihu.com/cfe/griffith/zhihu2018_hd.mp4',
  },
  sd: {
    play_url: 'https://zhstatic.zhihu.com/cfe/griffith/zhihu2018_sd.mp4',
  },
}

render(<Player sources={sources} />)

Detailed usage

Note: Griffith is not supporting SSR application

non-React application

<script src="https://unpkg.com/griffith-standalone/dist/index.umd.min.js"></script>
const sources = {
  hd: {
    play_url: 'https://zhstatic.zhihu.com/cfe/griffith/zhihu2018_hd.mp4',
  },
  sd: {
    play_url: 'https://zhstatic.zhihu.com/cfe/griffith/zhihu2018_sd.mp4',
  },
}

Griffith.createPlayer(element).render({sources})

Standalone mode detailed usage

Project Structure

Griffith is a Monorepo and uses Yarn workspace and Lerna.

Core

  • packages/griffith: The core library

Utilities

  • packages/griffith-message: Helpers for cross-window message
  • packages/griffith-utils: Utilities

Plugins

Others

  • example: example and demos
  • packages/griffith-standalone: A UMD build that can be used without React or Webpack

Custom Build

Build tools like webpack include griffith-mp4 and griffith-hls by default. You can make your bundle smaller by injecting aliases at build-time.

If you use webpack, do so with resolve.alias:

// webpack v5+
module.exports = {
  resolve: {
    alias: {
      'griffith-hls': false,
      'griffith-mp4': false,
    },
  },
}

// webpack v4
module.exports = {
  resolve: {
    alias: {
      'griffith-hls': 'griffith/null',
      'griffith-mp4': 'griffith/null',
    },
  },
}

Note that without griffith-mp4 / griffith-hls Griffith can no longer play MP4 / HLS media unless the browser supports it natively.

Contributing

Read below to learn how you can take part in improving Griffith.

Contributing Guide

Read our contributing guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to Griffith.

Contributor

LICENSE

MIT

More Repositories

1

Matisse

🎆 A well-designed local image and video selector for Android
Java
12,518
star
2

kids

Kids Is Data Stream
C++
1,225
star
3

rucene

Rust port of Lucene
Rust
1,005
star
4

cuBERT

Fast implementation of BERT inference directly on NVIDIA (CUDA, CUBLAS) and Intel MKL
C++
522
star
5

RxLifecycle

Bind observables to the lifecycle of Activity or Fragment in a non-invasive way.
Java
515
star
6

redis-shard

Redis sharding client library
Python
358
star
7

zhihu-rxjava-meetup

知乎 x RxJava Meetup
358
star
8

mirror

Yet another Sketch Mirror App for Android.
Java
272
star
9

SugarAdapter

Make RecyclerView.Adapter Great Again!
Java
235
star
10

zetta

Zetta Table Store
Go
130
star
11

norm

An orm library support nGQL for Golang
Go
103
star
12

tache

A tag based invalidation caching library
Python
77
star
13

promate

Graphite On VictoriaMetrics
Go
69
star
14

SERank

An efficient and effective learning to rank algorithm by mining information across ranking candidates. This repository contains the tensorflow implementation of SERank model. The code is developed based on TF-Ranking.
Python
50
star
15

cmdb

Programmable CMDB
Go
18
star
16

chaika

Elastic cache solution on Kubernetes
11
star
17

TLLM_QMM

TLLM_QMM strips the implementation of quantized kernels of Nvidia's TensorRT-LLM, removing NVInfer dependency and exposes ease of use Pytorch module. We modified the dequantation and weight preprocessing to align with popular quantization alogirthms such as AWQ and GPTQ, and combine them with new FP8 quantization.
C++
10
star
18

zetta-proto

Protobuf files for Zetta Table Store
Shell
7
star
19

presto-connectors

Presto Connectors project has been moved to TiBigData at PingCAP Incubator
6
star
20

zetta-client-go

Go client for Zetta Table Store
Go
4
star