Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyiya authored Jul 19, 2024
1 parent fe02626 commit 6eacfa0
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 137 deletions.
12 changes: 10 additions & 2 deletions packages/docs/src/pages/_meta.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"index": "Introduction",
"index": {
"title": "OPlayer",
"type": "page",
"theme": {
"layout": "full"
}
},
"doc": "Introduction",
"guide": "Guide",
"-- Plugins": {
"type": "separator",
Expand Down Expand Up @@ -37,8 +44,9 @@
"href": "https://discord.gg/hzjxYyPbKh",
"newWindow": true
},

"preview": {
"title": "Preview",
"title": "Documentation",
"type": "page",
"theme": {
"layout": "full"
Expand Down
5 changes: 5 additions & 0 deletions packages/docs/src/pages/doc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Md from '../../../../README.md'

![oplayer-mobile](https://cdn.jsdelivr.net/gh/shiyiya/QI-ABSL@master/o/oplayer-ui-mobile.jpg)

<Md />
4 changes: 1 addition & 3 deletions packages/docs/src/pages/guide/start.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Callout, Tab, Tabs } from 'nextra-theme-docs'

## Start as New Project

### Install
## Install

<Tabs items={['npm', 'script', 'script all(~28kB)']}>

Expand Down
133 changes: 129 additions & 4 deletions packages/docs/src/pages/index.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,130 @@
import Md from '../../../../README.md'
import React from 'react'
import { isMobile } from '@oplayer/core'
import Player from '@oplayer/react'
import hls from '@oplayer/hls'
import dash from '@oplayer/dash'
import mpegts from '@oplayer/mpegts'
import ui from '@oplayer/ui'
import danmaku from '@oplayer/danmaku'
import { Playlist, Chromecast, AirPlay } from '@oplayer/plugins'

![oplayer-mobile](https://cdn.jsdelivr.net/gh/shiyiya/QI-ABSL@master/o/oplayer-ui-mobile.jpg)

<Md />
<div className="nx-rounded-sm nx-overflow-hidden" style={{ maxWidth: '1024px', margin: '2.5rem auto' }}>
<Player
volume={0.6}
onEvent={(payload) => {
console.log(payload)
}}
plugins={[
ui({
theme: {
controller: { header: true, displayBehavior: 'delay' },
progress: { position: 'top' }
},
pictureInPicture: true,
menu: [
{
name: '',
position: 'top',
onClick() {
alert('miss u')
}
},
{
name: '💕',
position: 'top',
children: [
{
name: '🍓',
value: '🍓'
},
{
name: '🍉',
value: '🍉'
},
{
name: '🍎',
value: '🍎'
}
],
onChange({ value }) {
alert(`${value}`)
}
},
]
}),
hls({ forceHLS: true }),
dash(),
mpegts(),
!isMobile && danmaku({ enable: true, fontSize: 0.75, displaySender: false }),
new Playlist({
initialIndex: 0,
autoNext: true,
sources: [
{
title: '君の名は - MP4',
src: 'https://cdn.jsdelivr.net/gh/shiyiya/QI-ABSL@master/o/君の名は.mp4',
poster: 'https://cdn.jsdelivr.net/gh/shiyiya/QI-ABSL@master/o/poster.png',
duration: '01:32',
thumbnails: {
src: 'https://cdn.jsdelivr.net/gh/shiyiya/QI-ABSL@master/o/thumbnails.jpg',
number: 100
},
danmaku: 'https://cdn.jsdelivr.net/gh/shiyiya/QI-ABSL@master/o/danmaku.xml',
subtitles: [
{
name: 'Japanese',
default: true,
src: 'https://cdn.jsdelivr.net/gh/shiyiya/QI-ABSL@master/o/君の名は-jp.srt',
offset: 2
},
{
name: 'CH & JP',
src: 'https://cdn.jsdelivr.net/gh/shiyiya/QI-ABSL@master/o/君の名は.srt',
offset: 2
}
],
highlights: [
{
time: 12,
text: '谁でもいいはずなのに'
},
{
time: 34,
text: '夏の想い出がまわる'
},
{
time: 58,
text: 'こんなとこにあるはずもないのに'
},
{
time: 88,
text: '--终わり--'
}
]
},
{
title: 'Big Buck Bunny - HLS',
src: 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8',
duration: '10:34'
},
{
title: 'DASH',
src: 'https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps.mpd',
duration: '10:34'
},
{
title: 'FLV',
src: 'https://cdn.jsdelivr.net/gh/shiyiya/QI-ABSL@master/o/weathering-with-you.flv',
duration: '02:02'
},
{
title: 'webtorrent - MP4 + subtitle + poster',
src: 'https://webtorrent.io/torrents/sintel.torrent',
}
]
}),
new Chromecast(),
new AirPlay()
].filter((it) => it?.apply)}
/>
</div>
127 changes: 0 additions & 127 deletions packages/docs/src/pages/preview.mdx

This file was deleted.

2 changes: 1 addition & 1 deletion packages/docs/theme.config.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useConfig } from 'nextra-theme-docs'
import { useRouter } from 'next/router'

export default {
logo: <span>Documentation</span>,
logo: <span>OPlayer</span>,
project: { link: 'https://github.com/shiyiya/oplayer' },
docsRepositoryBase: 'https://github.com/shiyiya/oplayer/tree/main/packages/docs',
chat: {
Expand Down

0 comments on commit 6eacfa0

Please sign in to comment.