MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / cleanupTTSStreaming

Function cleanupTTSStreaming

packages/ui/src/views/chatmessage/ChatMessage.jsx:1949–1984  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1947 }
1948
1949 const cleanupTTSStreaming = () => {
1950 setTtsStreamingState((prevState) => {
1951 if (prevState.abortController) {
1952 prevState.abortController.abort()
1953 }
1954
1955 if (prevState.audio) {
1956 prevState.audio.pause()
1957 prevState.audio.removeAttribute('src')
1958 if (prevState.audio.src) {
1959 URL.revokeObjectURL(prevState.audio.src)
1960 }
1961 }
1962
1963 if (prevState.mediaSource) {
1964 if (prevState.mediaSource.readyState === 'open') {
1965 try {
1966 prevState.mediaSource.endOfStream()
1967 } catch (e) {
1968 // Ignore errors during cleanup
1969 }
1970 }
1971 prevState.mediaSource.removeEventListener('sourceopen', () => {})
1972 }
1973
1974 return {
1975 mediaSource: null,
1976 sourceBuffer: null,
1977 audio: null,
1978 chunkQueue: [],
1979 isBuffering: false,
1980 audioFormat: null,
1981 abortController: null
1982 }
1983 })
1984 }
1985
1986 const processChunkQueue = () => {
1987 setTtsStreamingState((prevState) => {

Callers 4

cleanupTTSForMessageFunction · 0.85
stopAllTTSFunction · 0.85
initializeTTSStreamingFunction · 0.85
ChatMessageFunction · 0.85

Calls 1

abortMethod · 0.80

Tested by

no test coverage detected