2021-09-07 17:36:50 +03:00
|
|
|
package rui
|
|
|
|
|
2024-09-12 14:05:11 +03:00
|
|
|
// AudioPlayer is a type of a [View] which can play audio files
|
2021-09-07 17:36:50 +03:00
|
|
|
type AudioPlayer interface {
|
|
|
|
MediaPlayer
|
|
|
|
}
|
|
|
|
|
|
|
|
type audioPlayerData struct {
|
|
|
|
mediaPlayerData
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewAudioPlayer create new MediaPlayer object and return it
|
2021-11-04 21:21:42 +03:00
|
|
|
func NewAudioPlayer(session Session, params Params) AudioPlayer {
|
2021-09-07 17:36:50 +03:00
|
|
|
view := new(audioPlayerData)
|
2022-09-01 11:04:50 +03:00
|
|
|
view.init(session)
|
2021-09-07 17:36:50 +03:00
|
|
|
view.tag = "AudioPlayer"
|
|
|
|
setInitParams(view, params)
|
|
|
|
return view
|
|
|
|
}
|
|
|
|
|
|
|
|
func newAudioPlayer(session Session) View {
|
|
|
|
return NewAudioPlayer(session, nil)
|
|
|
|
}
|
|
|
|
|
2022-09-01 11:04:50 +03:00
|
|
|
func (player *audioPlayerData) init(session Session) {
|
|
|
|
player.mediaPlayerData.init(session)
|
2021-09-07 17:36:50 +03:00
|
|
|
player.tag = "AudioPlayer"
|
|
|
|
}
|
|
|
|
|
2022-05-22 12:54:02 +03:00
|
|
|
func (player *audioPlayerData) String() string {
|
2024-05-02 15:07:57 +03:00
|
|
|
return getViewString(player, nil)
|
2022-05-22 12:54:02 +03:00
|
|
|
}
|
|
|
|
|
2021-09-07 17:36:50 +03:00
|
|
|
func (player *audioPlayerData) htmlTag() string {
|
|
|
|
return "audio"
|
|
|
|
}
|