Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
luxluth committed Jul 12, 2023
1 parent 01512ee commit aab8a62
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,74 @@ Display ASS/SSA subtitles on html5 videos
**🏗 PROJECT UNDER DEVELOPEMENT 🏗**

</div>

## Table of Contents
- [ass-html5](#ass-html5)
- [Table of Contents](#table-of-contents)
- [Installation](#installation)
- [Example](#example)
- [svelte and plry](#svelte-and-plry)

## Installation

```bash
pnpm add ass-html5
```

## Example

### [svelte](https://svelte.dev/) and [plry](https://github.com/sampotts/plyr)

```svelte
<script lang="ts">
import video from '$lib/assets/JJK0201.mp4'
import cc from '$lib/assets/JJK0201.ass?raw'
import ASS from 'ass-html5'
import { onMount } from 'svelte';
import Plyr from 'plyr'
const ass = new ASS({
assText: cc,
video: "#video-test"
})
const controls = [
'rewind',
'play',
'fast-forward',
'progress',
'current-time',
'duration',
'mute',
'volume',
'settings',
'airplay',
'fullscreen',
]
let vidElement: HTMLVideoElement
onMount(() => {
const player = new Plyr(vidElement, {
controls
})
ass.init()
})
</script>
<div class="video-container">
<!-- svelte-ignore a11y-media-has-caption -->
<video
preload="metadata"
src="{video}"
id="video-test"
controls
autoplay
class="vid"
bind:this={vidElement}
></video>
</div>
```

0 comments on commit aab8a62

Please sign in to comment.