Documentation
¶
Index ¶
- Constants
- type ControlsMode
- type CuePlaylistOptions
- type Error
- type Event
- type EventType
- type ListType
- type LoadByIDOptions
- type LoadByURLOptions
- type Player
- func (p *Player) AddEventListener(event EventType, listener func(event *Event))
- func (p *Player) AvailablePlaybackRates() []float64
- func (p *Player) AvailableQualityLevels() []Quality
- func (p *Player) CuePlaylist(ids []string, index int, startSec float64, q Quality)
- func (p *Player) CuePlaylist2(params *CuePlaylistOptions)
- func (p *Player) CueVideoByID(vid string, startSec float64, q Quality)
- func (p *Player) CueVideoByID2(params *LoadByIDOptions)
- func (p *Player) CurrentTime() float64
- func (p *Player) Destroy()
- func (p *Player) Duration() float64
- func (p *Player) Iframe() *js.Object
- func (p *Player) IsMuted() bool
- func (p *Player) LoadPlaylist(ids []string, index int, startSec float64, q Quality)
- func (p *Player) LoadPlaylist2(params *CuePlaylistOptions)
- func (p *Player) LoadVideoByID(vid string, startSec float64, q Quality)
- func (p *Player) LoadVideoByID2(params *LoadByIDOptions)
- func (p *Player) LoadVideoByURL(url string, startSec float64, q Quality)
- func (p *Player) LoadVideoByURL2(params *LoadByURLOptions)
- func (p *Player) Mute()
- func (p *Player) NextVideo()
- func (p *Player) PauseVideo()
- func (p *Player) PlayVideo()
- func (p *Player) PlayVideoAt(index int)
- func (p *Player) PlaybackQuality() Quality
- func (p *Player) PlaybackRate() float64
- func (p *Player) PlayerState() PlayerState
- func (p *Player) Playlist() []string
- func (p *Player) PlaylistIndex() int
- func (p *Player) PreviousVideo()
- func (p *Player) RemoveEventListener(event EventType, listener func(event *Event))
- func (p *Player) SeekTo(seconds float64, allowSeekAhead bool)
- func (p *Player) SetLoop(val bool)
- func (p *Player) SetPlaybackQuality(suggested Quality)
- func (p *Player) SetPlaybackRate(suggestedRate float64)
- func (p *Player) SetShuffle(val bool)
- func (p *Player) SetSize(width int, height int) *js.Object
- func (p *Player) SetVolume(vol int)
- func (p *Player) StopVideo()
- func (p *Player) UnMute()
- func (p *Player) VideoData() *VideoData
- func (p *Player) VideoEmbedCode() string
- func (p *Player) VideoLoadedFraction() float64
- func (p *Player) VideoURL() string
- func (p *Player) Volume() int
- type PlayerEvents
- type PlayerParams
- type PlayerState
- type ProgessBarColor
- type Properties
- type Quality
- type VideoData
Constants ¶
const ( // IvPolicyShown shows video's annotation IvPolicyShown = iota + 1 // IvPolicyNotShown hides video's annotation IvPolicyNotShown )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ControlsMode ¶
type ControlsMode int
const ( // ControlsNotDisplay has the player controls not displayed in the player ControlsNotDisplay ControlsMode = iota // ControlsDisplayImmediately has the controls displayed immediately and // the Flash player also loads immediately. ControlsDisplayImmediately // ControlsDisplayAfter has the controls displayed, and the Flash player // loaded after the user initiates the video playback. ControlsDisplayAfter )
type CuePlaylistOptions ¶
type CuePlaylistOptions struct {
*js.Object
ListType ListType `js:"listType"`
// the ID of the list
List string `js:"list"`
Index int `js:"index"`
StartSeconds float64 `js:"startSeconds"`
SuggestedQuality Quality `js:"suggestedQuality"`
}
CuePlaylistOptions represents an argument for Player.CuePlaylist2(arg)
func NewCuePlaylistOptions ¶
func NewCuePlaylistOptions() *CuePlaylistOptions
NewCuePlaylistOptions prepares an argument for Player.CuePlaylist2(arg) with all inner objects properly initialized
type LoadByIDOptions ¶
type LoadByIDOptions struct {
*js.Object
VideoID string `js:"videoId"`
StartSeconds float64 `js:"startSeconds"`
EndSeconds float64 `js:"endSeconds"`
SuggestedQuality Quality `js:"suggestedQuality"`
}
LoadByIDOptions represents an argument for Player.LoadVideoByID2(arg) and Player.CueVideoByID2(arg)
func NewLoadByIDOptions ¶
func NewLoadByIDOptions() *LoadByIDOptions
NewLoadByIDOptions prepares an argument for Player.LoadVideoByID2(arg) and Player.CueVideoByID2(arg) with all inner objects properly initialized
type LoadByURLOptions ¶
type LoadByURLOptions struct {
*js.Object
MediaContentURL string `js:"mediaContentUrl"`
StartSeconds float64 `js:"startSeconds"`
EndSeconds float64 `js:"endSeconds"`
SuggestedQuality Quality `js:"suggestedQuality"`
}
LoadByURLOptions represents an argument for Player.LoadVideoByUrl2(arg)
func NewLoadByURLOptions ¶
func NewLoadByURLOptions() *LoadByURLOptions
NewLoadByURLOptions returns a prepared argument for Player.LoadeVideoByUrl2(arg) with all inner objects properly initialized
type Player ¶
Player represents the Youtube Iframe player
func NewPlayer ¶
func NewPlayer(iframeID string, props *Properties) *Player
NewPlayer creates a new youtube player by replacing the provided iframe with the id of iframeId This call is equivalent to new YT.Player(id, props)
func (*Player) AddEventListener ¶
func (*Player) AvailablePlaybackRates ¶
AvailableRates returns the set of playback rates in which the current video is available
func (*Player) AvailableQualityLevels ¶
func (*Player) CuePlaylist ¶
func (*Player) CuePlaylist2 ¶
func (p *Player) CuePlaylist2(params *CuePlaylistOptions)
func (*Player) CueVideoByID ¶
func (*Player) CueVideoByID2 ¶
func (p *Player) CueVideoByID2(params *LoadByIDOptions)
func (*Player) CurrentTime ¶
func (*Player) LoadPlaylist ¶
func (*Player) LoadPlaylist2 ¶
func (p *Player) LoadPlaylist2(params *CuePlaylistOptions)
func (*Player) LoadVideoByID ¶
func (*Player) LoadVideoByID2 ¶
func (p *Player) LoadVideoByID2(params *LoadByIDOptions)
func (*Player) LoadVideoByURL ¶
func (*Player) LoadVideoByURL2 ¶
func (p *Player) LoadVideoByURL2(params *LoadByURLOptions)
func (*Player) PauseVideo ¶
func (p *Player) PauseVideo()
func (*Player) PlayVideoAt ¶
func (*Player) PlaybackQuality ¶
func (*Player) PlaybackRate ¶
func (*Player) PlayerState ¶
func (p *Player) PlayerState() PlayerState
func (*Player) PlaylistIndex ¶
func (*Player) PreviousVideo ¶
func (p *Player) PreviousVideo()
func (*Player) RemoveEventListener ¶
func (*Player) SetPlaybackQuality ¶
func (*Player) SetPlaybackRate ¶
func (*Player) SetShuffle ¶
func (*Player) VideoEmbedCode ¶
func (*Player) VideoLoadedFraction ¶
type PlayerEvents ¶
type PlayerEvents struct {
*js.Object
OnReady func(*Event) `js:"onReady"`
OnStateChange func(*Event) `js:"onStateChange"`
OnPlaybackQualityChange func(*Event) `js:"onPlaybackQualityChange"`
OnPlaybackRateChange func(*Event) `js:"onPlaybackRateChange"`
OnError func(*Event) `js:"onError"`
OnAPIChange func(*Event) `js:"onApiChange"`
}
PlayerEvents contains a set of callbacks assigned at the creation of the player. This struct's fields correspond to each youtube.EventType
type PlayerParams ¶
type PlayerParams struct {
*js.Object
Autoplay int `js:"autoplay"`
CcLoadPolicy int `js:"cc_load_policy"`
Color ProgessBarColor `js:"color"`
Controls ControlsMode `js:"controls"`
DisableKB int `js:"disablekb"`
EnableJsAPI int `js:"enablejsapi"`
End int `js:"end"`
Fs int `js:"fs"`
Hl string `js:"hl"`
IvLoadPolicy int `js:"iv_load_policy"`
List string `js:"list"`
ListType ListType `js:"listType"`
Loop int `js:"loop"`
ModestBranding int `js:"modestbranding"`
Origin string `js:"origin"`
Playlist []string `js:"playlist"`
PlaysInline int `js:"playsinline"`
Rel int `js:"rel"`
ShowInfo int `js:"showinfo"`
Start int `js:"start"`
WidgetReferrer string `js:"widget_referrer"`
}
PlayerParams represents the player parameter documented at https://developers.google.com/youtube/player_parameters
type PlayerState ¶
type PlayerState int
PlayerState represents the youtube player's state
const ( Unstarted PlayerState = iota - 1 Ended Playing Paused Buffering VideoCued )
type ProgessBarColor ¶
type ProgessBarColor string
const ( Red ProgessBarColor = "red" White ProgessBarColor = "white" )
type Properties ¶
type Properties struct {
*js.Object
Width int `js:"width"`
Height int `js:"height"`
VideoID string `js:"videoId"`
PlayerVars *PlayerParams `js:"playerVars"`
Events *PlayerEvents `js:"events"`
}
Properties represents a set of video properties feeded to NewPlayer(id, properties) to create the player. NewProperties() is recommended to create the properties.
func NewProperties ¶
func NewProperties() *Properties
NewProperties creates a new Property JS object with all inner objects properly initialized
Directories
¶
| Path | Synopsis |
|---|---|
|
Package ytutil contains utility functions for setting up the Youtube Iframe API The application, however, can be set up without using this package.
|
Package ytutil contains utility functions for setting up the Youtube Iframe API The application, however, can be set up without using this package. |