Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Reshma
Reel Rookie

audio playing in background after exiting the player

While playing the content , if i click back button the player exited and coming to details page and the audion continues to play.

here is my code:

function stopPlayer(resetAnalytics = false, forceStop = false)
playerState = m.videoPlayer.state
?"playerState: "playerState
?"m.videoPlayer.control: "m.videoPlayer.control
?"forceStop: "forceStop
?"m.stopTimer: "m.stopTimer
if playerState <> "stopped" and playerState <> "none" and playerState <> "finished" and m.videoPlayer.control <> "stop"
?"***stop1"
m.videoPlayer.control = "stop"
else if forceStop and m.stopTimer = invalid 'Fix for XC-21409
?"***stop2"
m.videoPlayer.observeField("state", "onVideoPlayerStateChangeAfterStop")
createStopTimer()
end if
end function
 
function onVideoPlayerStateChangeAfterStop()

handleForceStop()

end function

function handleForceStop()

playerState = m.videoPlayer.state
?"playerState: "playerState

m.videoPlayer.unobserveField("state")
if playerState = "playing" or playerState = "buffering" or playerState = "paused"
m.videoPlayer.control = "stop"
end if
removeStopTimer()

end function

function removeStopTimer()

m.stopTimer.unobserveField("fire")
m.stopTimer.control = "stop"
m.videoPlayerScreen.removeChild(m.stopTimer)
m.stopTimer = invalid

end function
playerState i am getting as stopped and m.videoPlayer.control: stop, forcestop as true and m.stopTimer as invalid in stopplayer function.
 
please help me with this.
Thanks in Advance

 
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.