Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/onema/playlist-dsl
Experimental Kotlin DSL to create HLS master and media playlist.
https://github.com/onema/playlist-dsl
hls hls-live-streaming hls-stream video-streaming
Last synced: about 2 months ago
JSON representation
Experimental Kotlin DSL to create HLS master and media playlist.
- Host: GitHub
- URL: https://github.com/onema/playlist-dsl
- Owner: onema
- License: apache-2.0
- Created: 2020-09-27T17:54:17.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-28T04:21:34.000Z (about 4 years ago)
- Last Synced: 2024-04-09T08:34:50.196Z (6 months ago)
- Topics: hls, hls-live-streaming, hls-stream, video-streaming
- Language: Kotlin
- Homepage:
- Size: 67.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# playlist-dsl
## Install
In your dependencies:
```
implementation("io.onema:playlist-dsl:0.1.0")
```## Example
### Master Playlist
```kotlin
import io.onema.manifestservice.playlist.masterval master = master playlist {
version set 5
add stream {
streamInf resolution "resolution1" codecs "codec" bandwidth 12345 frameRate 123F
info name "videoName" rendition "rendition"
}
}
val expectation = """#EXTM3U
|#EXT-X-VERSION:5
|#EXT-X-STREAM-INF:RESOLUTION=resolution1,CODECS="codec",BANDWIDTH=12345,FRAME-RATE=123.000
|media/rendition""".trimMargin()
assertEquals(expectation, master)
```### Media Playlist
```kotlin
import io.onema.manifestservice.playlist.PlaylistTypeEnum.VOD
import io.onema.manifestservice.playlist.mediaval media = media playlist {
version set 5
type set VOD
mediaSequence set 0
targetDuration set 6
method value "NONE"
add segment {
extInf duration 2.0F
byteRange length 123 position 321
info name "videoName" rendition "rendition"
}
}
val expectation = """#EXTM3U
|#EXT-X-VERSION:5
|#EXT-X-PLAYLIST-TYPE:VOD
|#EXT-X-MEDIA-SEQUENCE:0
|#EXT-X-TARGETDURATION:6
|#EXT-X-KEY:METHOD=NONE
|#EXTINF:2.0
|#EXT-X-BYTERANGE:123@321
|segment/rendition
|#EXT-X-ENDLIST""".trimMargin()
assertEquals(expectation, media, "Media playlist didn't match expected value")
```## Reference
**Most of the docblock text is taken from or is praphrased of the [RFC8216 - HTTP Live Streaming](https://tools.ietf.org/html/rfc8216).**