랭킹으로 돌아가기

zhihu/griffith

TypeScriptcodesandbox.io/embed/p03wm0o80

A React-based web video player

zhihump4fmp4hlsreactvideomp4boxhtml5-videohtml5-video-playerzhihu-video-playerreact-components
스타 성장
스타
2.5k
포크
226
주간 성장
이슈
21
1k1.5k2k2.5k
2019년 3월2021년 8월2024년 2월2026년 7월
아티팩트npmnpm install griffith
README

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

관련 저장소
DIYgod/RSSHub

🧡 Everything is RSSible

TypeScriptnpmGNU Affero General Public License v3.0rsstwitter
docs.rsshub.app
45.3k10k
lining0806/PythonSpiderNotes

Python入门网络爬虫之精华版

PythonPyPIpythonzhihu
7.5k2.2k
xchaoinfo/fuck-login

模拟登录一些知名的网站,为了方便爬取需要登录的网站

PythonPyPIweibozhihu
5.9k2k
cs-lazy-tools/ChatGPT-On-CS

基于大模型的智能对话客服工具,支持微信、拼多多、千牛、哔哩哔哩、抖音企业号、抖音、抖店、微博聊天、小红书专业号运营、小红书、知乎等平台接入,可选择 GPT3.5/GPT4.0/ 懒人百宝箱 (后续会支持更多平台),能处理文本、语音和图片,通过插件访问操作系统和互联网等外部资源,支持基于自有知识库定制企业 AI 应用。

TypeScriptnpmGNU Affero General Public License v3.0aiautomation
xingsuancn.com
4.2k537
codeestX/GeekNews

:books:A pure reading App based on Material Design + MVP + RxJava2 + Retrofit + Dagger2 + Realm + Glide

JavaMavenmaterial-designrxjava
3.5k815
zly2006/zhihu-plus-plus

Zhihu++ | 知乎++: Ad-free, low cost, AI powered zhihu android 3rd-party client. 去广告、占用低、AI大模型的新时代知乎安卓端体验

KotlinGNU Affero General Public License v3.0androidzhihu
3.4k161
CharlesPikachu/DecryptLogin

DecryptLogin: APIs for loginning some websites by using requests.

PythonPyPIApache License 2.0requestslogin
httpsgithubcomcharlespikachudecryptlogin.readthedocs.io/zh/latest/
2.9k745
shatyuka/Zhiliao

知乎去广告Xposed模块

JavaMavenGNU General Public License v3.0zhiliaoxposed
repo.xposed.info/module/com.shatyuka.zhiliao
2.8k120
brianway/webporter

基于 webmagic 的 Java 爬虫应用

JavaMavenelasticsearchkibana
2.8k848
onblog/BlogHelper

帮助国内用户写作的托盘助手,一键发布本地文章到主流博客平台(知乎、简书、博客园、CSDN、SegmentFault、掘金、开源中国),剪贴板图片一键上传至图床(新浪、Github、图壳、腾讯云、阿里云、又拍云、七牛云)(欢迎Star,🚫禁止Fork)

JavaScriptnpmGNU General Public License v3.0electronblog
2k283
whiteguo233/OpenBiliClaw

本地私有的跨平台 AI 内容发现 Agent——先深度理解你,再主动去 B站/小红书/抖音/YouTube/X/知乎/Reddit 找你会喜欢的内容。Local-first AI agent that learns who you are, then hunts content you'll love across platforms.

PythonPyPIMIT Licenseai-agentbilibili
whiteguo233.github.io/OpenBiliClaw/
1.4k88
hilongjw/vue-zhihu-daily

zhihu daily spa with vue 线上演示在这里 ---->

JavaScriptnpmvuezhihu-daily
zhihu.bood.in
1.3k268