Documentation
¶
Index ¶
Constants ¶
const BrowserUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15"
BrowserUserAgent is used for media endpoints that expect a browser request.
Variables ¶
This section is empty.
Functions ¶
func FetchContext ¶
FetchContext downloads a public media resource for the lifetime of ctx.
func SizedArtworkURL ¶
SizedArtworkURL keeps the cache and request format of the original artwork references. Plugin references carry their rendering size in the size query.
Types ¶
type MediaEndpoint ¶
MediaEndpoint holds the address and request headers for the same audio.
type MediaRenew ¶
type MediaRenew func(context.Context, MediaEndpoint) (MediaEndpoint, error)
type MediaSource ¶
type MediaSource struct {
// contains filtered or unexported fields
}
MediaSource keeps refreshed credentials local to one playback resource.
func NewMediaSource ¶
func NewMediaSource(rawURL string, header func() http.Header, renew MediaRenew, userAgent string) *MediaSource
func (*MediaSource) Open ¶
func (s *MediaSource) Open(ctx context.Context, client *http.Client, method string, options http.Header) (*http.Response, error)
Open retries an unauthorized request once before returning any audio. The caller's Range and other explicit request options are used on both requests.