Open-source project
zhihu/griffith avatar
zhihu/griffith

Griffith's two front doors, its removable plugins, and a tag that stopped in 2019

A React-based web video player

2,505 stars227 forksTypeScriptMIT

At a glance

What is it?
The Zhihu video player is a React component and a UMD script wrapped around one sources map, with MP4 and HLS parked in plugins you can alias away at build time; the newest published version is v1.5.0 from May 2019 while the repository itself was pushed to in June 2026.
Who is it for?
Griffith fits a React app that already has a sources map and a client only boundary for the player, and it fits a plain page that would rather load one script from unpkg than add a bundler. Check two things before you commit to it: whether your pages render on a server, since SSR is declared unsupported, and whether you need MP4 or HLS in browsers that cannot play them natively, because that is exactly what the two plugins you can delete are for.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 153 days ago.
What is it written in?
Mainly TypeScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • zhihu/griffith2,505 ★ · -2
Star history
Repository2026-09-302026-11-15
zhihu/griffith2.5k2.5k

-2 Stars in the last 46 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

One sources map behind two front doors

The React path is `yarn add griffith`, an import of the default export named `Player`, and a render call that takes a single prop. The non-React path skips the package manager entirely: a script tag pointing at `https://unpkg.com/griffith-standalone/dist/index.umd.min.js`, then `Griffith.createPlayer(element).render({sources})` on the element you want the player in. Both samples build the same object, with `hd` and `sd` keys whose `play_url` values are files on `zhstatic.zhihu.com`, so the example you copy out is Zhihu's own sample media rather than anything of yours. The project's homepage points at a CodeSandbox embed, which is where the runnable demo actually lives.

js
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} />)

sources is the whole prop surface shown at the root

Everything the root file shows about the API stops at that one prop. Each entry is a quality name holding a `play_url`, and nothing else appears: no poster, no autoplay, no callbacks, no event names, no error state, no width or height. The detail is delegated to two per-package documents, `packages/griffith/README.md` for the React library and `packages/griffith-standalone/README.md` for the script build, so any decision about player controls has to be made by reading package level files rather than the page a search engine lands on. The only statement about real world reach is the line saying the player has been widely used in the web and mobile web of Zhihu, and it carries no version number, no usage count, and no page that demonstrates it.

Streaming needs Media Source Extensions, and SSR is ruled out by note

For both mp4 and hls the player loads segments through Media Source Extension, with `packages/griffith-mp4` sitting on the MediaSource API and `packages/griffith-hls` on hls.js. That is a browser interface doing the work, and the root file carries one short note on the subject: Griffith is not supporting SSR application. For a React application that renders on a server this is a boundary, not a warning, because the player has to be kept on the client side of it. What the file does not give you is a wrapper component, a dynamic import example, or a list of which props are safe to evaluate on a server, so the shape of that boundary is left to you. Anyone who hits the problem will end up in the issue tracker rather than here.

MP4 and HLS are plugins you can delete at build time

Build tools such as webpack pull in `griffith-mp4` and `griffith-hls` by default, and the file gives you a way to keep them out of your bundle by injecting aliases at build time. The syntax changed with the bundler: webpack 5 aliases each package to `false`, webpack 4 aliases it to the string `'griffith/null'`. The caveat printed under the snippet is the part worth reading twice. Without those two plugins the player can no longer play MP4 or HLS media unless the browser supports it natively, which makes the trade uneven across browsers: drop the plugin and you save bytes, but on a browser with no native HLS you have also dropped the feature.

javascript
// 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',
    },
  },
}

The manifest advertises dash and mp4box, the packages ship mp4 and hls

The keyword list in the root manifest includes `fmp4`, `dash`, and `mp4box` next to `mp4`, `hls`, and `html5-video`. The packages directory behind it holds `griffith` as the core library, `griffith-message` for cross-window message helpers, `griffith-utils` for utilities, the two streaming plugins, and `griffith-standalone` for the UMD build. No package in that set carries a DASH name, so picking this library up by keyword leads to a capability with nothing behind it in this tree. The same manifest describes the project as Zhihu Video Player, marks itself `"private": true`, and points its own homepage field at the readme, while the readme header calls it a React-based Web video player. Three descriptions of one project, none of them reconciled anywhere.

Three releases in three weeks, then nothing after v1.5.0

The release history is short and dense: v1.4.4 on 2019-04-24, v1.4.5 on 2019-04-28, and v1.5.0 on 2019-05-13. After that the list stops, while the last recorded push to the repository is 2026-06-15. What moved in between is the project's own machinery rather than the published package: the manifest asks for rollup plugins at version 25, commitlint config-conventional at 19, typescript-eslint at 7, and @testing-library/react at 14, none of which existed when v1.5.0 was cut. The practical split is that installing `griffith` at its newest tag gives you 2019 code, and following the master branch gives you a tree the release history says nothing about.

Build, test and deploy each go through Lerna with a different scope

The repository is a monorepo on Yarn workspaces with Lerna, and the workspaces are `packages/*`, `example`, and `website`. The plumbing is worth reading before you trust a green master: `build:lib` runs a Lerna build scoped to `griffith*` and appends `--bundleConfigAsCjs`, `build:watch` adds `--parallel` but also `--ignore griffith-standalone`, so the UMD bundle is the one artifact not rebuilt while you watch, and `release` is `yarn build && lerna publish`. Tests run jest with `NODE_OPTIONS=--experimental-vm-modules`, which is the switch es-jest needs for ESM, and `start` hands off to the example workspace, a vite project with its own tsconfig. Around all of it sit husky, commitlint, eslint, prettier, a `jest/` directory, a root CHANGELOG.md, and a second CHANGELOG.md inside `example/`.

Editorial conclusion

Griffith fits a React app that already has a sources map and a client only boundary for the player, and it fits a plain page that would rather load one script from unpkg than add a bundler. Check two things before you commit to it: whether your pages render on a server, since SSR is declared unsupported, and whether you need MP4 or HLS in browsers that cannot play them natively, because that is exactly what the two plugins you can delete are for. Pinning to the newest tag means installing code from 2019, and the manifest advertises a DASH capability that no package in this tree provides.

Frequently asked questions

How do I add the Griffith video player to a page?

In React, `yarn add griffith`, then `import Player from 'griffith'` and render `<Player sources={sources} />`. Without React, load the UMD build from unpkg and call `Griffith.createPlayer(element).render({sources})`.

Does Griffith support server side rendering in React?

It does not. A note in the project's file says Griffith is not supporting SSR application, and no wrapper or dynamic import recipe comes with it, so the player has to sit behind a client only boundary you write yourself.

Can Griffith still play MP4 and HLS after removing its plugins?

Only where the browser plays them natively. Without `griffith-mp4` and `griffith-hls` aliased out, the player can no longer play MP4 or HLS media unless the browser supports it natively.

Which packages make up the Griffith monorepo?

`packages/griffith` is the core library, `packages/griffith-message` handles cross-window messages, `packages/griffith-utils` holds utilities, `packages/griffith-mp4` and `packages/griffith-hls` are the streaming plugins, and `packages/griffith-standalone` is the UMD build.

What is the newest published version of Griffith?

v1.5.0, dated 2019-05-13, after v1.4.5 on 2019-04-28 and v1.4.4 on 2019-04-24. The last recorded push to the repository is 2026-06-15.

Does the Griffith repository rebuild the standalone bundle in watch mode?

No. `build:watch` passes `--ignore griffith-standalone` next to `--parallel`, while `build:lib` builds every `griffith*` package with `--bundleConfigAsCjs` appended.

Official sources

  1. License: MIT
  2. Project website
  3. README
  4. Releases
  5. zhihu/griffith on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/zhihu-griffith.svg)](https://hysenlabs.com/projects/zhihu-griffith)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/zhihu-griffith.svg)](https://hysenlabs.com/projects/zhihu-griffith)

Was this useful?