2022-02-23 00:33:55 +01:00
|
|
|
export default class AudioTrack {
|
|
|
|
constructor(track) {
|
|
|
|
this.index = track.index || 0
|
|
|
|
this.startOffset = track.startOffset || 0 // Total time of all previous tracks
|
|
|
|
this.duration = track.duration || 0
|
|
|
|
this.title = track.filename || ''
|
|
|
|
this.contentUrl = track.contentUrl || null
|
|
|
|
this.mimeType = track.mimeType
|
|
|
|
}
|
|
|
|
|
|
|
|
get fullContentUrl() {
|
|
|
|
if (!this.contentUrl || this.contentUrl.startsWith('http')) return this.contentUrl
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV === 'development') {
|
|
|
|
return `${process.env.serverUrl}${this.contentUrl}`
|
|
|
|
}
|
2022-02-23 02:02:01 +01:00
|
|
|
return `${window.location.origin}${this.contentUrl}`
|
2022-02-23 00:33:55 +01:00
|
|
|
}
|
2022-03-05 01:44:20 +01:00
|
|
|
|
|
|
|
get relativeContentUrl() {
|
|
|
|
if (!this.contentUrl || this.contentUrl.startsWith('http')) return this.contentUrl
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV === 'development') {
|
|
|
|
return `${process.env.serverUrl}${this.contentUrl}`
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.contentUrl
|
|
|
|
}
|
2022-02-23 00:33:55 +01:00
|
|
|
}
|