Added Docs for stream seek
This commit is contained in:
parent
4b4875b97f
commit
f6287bc1b7
13
package-lock.json
generated
13
package-lock.json
generated
@ -8,6 +8,9 @@
|
||||
"name": "play-dl",
|
||||
"version": "1.5.0",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"play-audio": "^0.4.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.9.4",
|
||||
"prettier": "^2.3.1",
|
||||
@ -970,6 +973,11 @@
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/play-audio": {
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/play-audio/-/play-audio-0.4.3.tgz",
|
||||
"integrity": "sha512-DOLTP1+cgXH0k1ZdZyXXRsAPnVrzV2xZV6EXpWRsMtk24oolS7mD3WUQltuCeuJXKGM1tIsXLr+EZo6Ky4aKRg=="
|
||||
},
|
||||
"node_modules/postcss-load-config": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-3.1.0.tgz",
|
||||
@ -2050,6 +2058,11 @@
|
||||
"integrity": "sha512-ZIrVPH+A52Dw84R0L3/VS9Op04PuQ2SEoJL6bkshmiTic/HldyW9Tf7oH5mhJZBK7NmDx27vSMrYEXPXclpDKw==",
|
||||
"dev": true
|
||||
},
|
||||
"play-audio": {
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/play-audio/-/play-audio-0.4.3.tgz",
|
||||
"integrity": "sha512-DOLTP1+cgXH0k1ZdZyXXRsAPnVrzV2xZV6EXpWRsMtk24oolS7mD3WUQltuCeuJXKGM1tIsXLr+EZo6Ky4aKRg=="
|
||||
},
|
||||
"postcss-load-config": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-3.1.0.tgz",
|
||||
|
||||
@ -46,8 +46,11 @@
|
||||
"prettier": "^2.3.1",
|
||||
"tsup": "^5.11.1",
|
||||
"typedoc": "^0.22.9",
|
||||
"typedoc-plugin-extras": "^2.2.1",
|
||||
"typedoc-plugin-missing-exports": "^0.22.4",
|
||||
"typescript": "^4.4.4",
|
||||
"typedoc-plugin-extras": "^2.2.1"
|
||||
"typescript": "^4.4.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"play-audio": "^0.4.3"
|
||||
}
|
||||
}
|
||||
@ -86,6 +86,8 @@ import { YouTubeChannel } from './YouTube/classes/Channel';
|
||||
import { SpotifyAlbum, SpotifyPlaylist, SpotifyTrack } from './Spotify/classes';
|
||||
import { DeezerAlbum, DeezerPlaylist, DeezerTrack } from './Deezer/classes';
|
||||
|
||||
export async function stream(url: string, options: { seek? : number , seekMode?: 'precise' | 'granular'} & StreamOptions) : Promise<YouTubeStream>
|
||||
export async function stream(url: string, options? : StreamOptions) : Promise<YouTubeStream | SoundCloudStream>
|
||||
/**
|
||||
* Creates a Stream [ YouTube or SoundCloud ] class from a url for playing.
|
||||
*
|
||||
@ -95,6 +97,13 @@ import { DeezerAlbum, DeezerPlaylist, DeezerTrack } from './Deezer/classes';
|
||||
*
|
||||
* const source = await play.stream('soundcloud track URL') // SoundCloud Track Stream
|
||||
*
|
||||
* const source = await play.stream('youtube video URL', { seek : 45 }) // Seeks 45 seconds (approx.) in YouTube Video Stream [ seekMode = "granular" ]
|
||||
* // Granular = 1 - 9 seconds before given time. [ Fast ]
|
||||
* // Precise = Exact seek [ Little bit Slow ]
|
||||
* // Above command seeks to 45 seconds approximately while below command seeks to 45 seconds precisely
|
||||
*
|
||||
* const source = await play.stream('youtube video URL', { seek : 45, seekMode: "precise" }) // Seeks precisely to 45 seconds in YouTube Video Stream
|
||||
*
|
||||
* const resource = createAudioResource(source.stream, {
|
||||
* inputType : source.type
|
||||
* }) // Use discordjs voice createAudioResource function.
|
||||
@ -215,6 +224,8 @@ export async function search(
|
||||
else throw new Error('Not possible to reach Here LOL. Easter Egg of play-dl if someone get this.');
|
||||
}
|
||||
|
||||
export async function stream_from_info(info: SoundCloudTrack, options? : StreamOptions) : Promise<SoundCloudStream>
|
||||
export async function stream_from_info(info: InfoData, options? : StreamOptions) : Promise<YouTubeStream>
|
||||
/**
|
||||
* Creates a Stream [ YouTube or SoundCloud ] class from video or track info for playing.
|
||||
*
|
||||
@ -226,6 +237,13 @@ export async function search(
|
||||
* const soundInfo = await play.soundcloud('SoundCloud URL')
|
||||
* const source = await play.stream_from_info(soundInfo) // SoundCloud Track Stream
|
||||
*
|
||||
* const source = await play.stream_from_info(info, { seek : 45 }) // Seeks 45 seconds (approx.) in YouTube Video Stream [ seekMode = "granular" ]
|
||||
* // Granular = 1 - 9 seconds before given time. [ Fast ]
|
||||
* // Precise = Exact seek [ Little bit Slow ]
|
||||
* // Above command seeks to 45 seconds approximately while below command seeks to 45 seconds precisely
|
||||
*
|
||||
* const source = await play.stream_from_info(info, { seek : 45, seekMode: "precise" }) // Seeks precisely to 45 seconds in YouTube Video Stream
|
||||
*
|
||||
* const resource = createAudioResource(source.stream, {
|
||||
* inputType : source.type
|
||||
* }) // Use discordjs voice createAudioResource function.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user