12์ 1์ผ (๊ธ)
- AVPlayer๋ฅผ ๋ด์ ์ ์ ์ฌ์ฌ์ฉํ ๋, AVPlayerItem์ ํ ๋นํ์ฌ ์ฌ์ํ๊ณ ์๋๋ฐ, play()๋ ์ ๋๋ก ํธ์ถํ๊ณ ์์ผ๋ waitingToPlayAtSpecifiedRate์์ playing์ผ๋ก ๋์ด๊ฐ์ง ์๊ณ ๋ฌดํ ๋ก๋ฉ์ด ๊ฑธ๋ฆฌ๋ ๋ฌธ์ ํด๊ฒฐ
ย
๋น๋์ค ์คํธ๋ฆฌ๋ฐ์ ์ฌ์ํ๋ ์ ์ด ์ปฌ๋ ์ ๋ทฐ ๋ฆฌ๋ก๋๋ฅผ ํ ๋, ์ฌ์ํ๋๊ฑธ ๋ฉ์ถ๊ณ ์ ์ ๋ชจ๋ ๋ฆฌ์ ํ ๋ค์ ๋ค์ ๋ฐ์ดํฐ๊ฐ ์ค์ ๋๋ฉด์ ๋น๋์ค ์คํธ๋ฆฌ๋ฐ์ ์ฌ์ํด์ผํ๋๋ฐ, ๋ช๊ฐ์ ์ ๋ค์ด ๊ฐํ์ ์ผ๋ก ์ฌ์๋์ง ์๋ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ฌ ์ด๋ฅผ ํด๊ฒฐํด๋ณด์๋ค.
์ฒ์์ ๋น๋์ค๋ฅผ ์๋ ์ฌ์์ ํ๋ ๋ก์ง์ด๋ ์ฌ์ํ๋ ์์ ๋ก์ง์ ๋ฌธ์ ๊ฐ ์๊ฒจ ์ฌ์ด๋ ์ดํํธ๊ฐ ์ผ์ด๋๋ ์ค ์์๋ค.
ํ์ง๋ง ๋๋ฒ๊น
ํด๋ณด๋ ๋ก์ง์๋ ๋ฌธ์ ๊ฐ ์์๊ณ ์ ์์ ์ผ๋ก AVPlayer์
play()
๋ฉ์๋๋ ์ ๋๋ก ํธ์ถ๋๊ณ ์์๋ค.
๊ทธ๋์ AVPlayer์ timeControlStatus
, reasonForWaitingToPlay๋ฅผ
๊ด์ฐฐํด๋ณด์๋ค.
timeControlStatus๊ฐ
waitingToPlayAtSpecifiedRate
์์playing
์ผ๋ก ๋ฐ๋์ด์ผํ๋๋ฐ, ๊ฐํ์ ์ผ๋ก ๋ฐ๋์ง ์๊ณ ๊ณ์waitingToPlayAtSpecifiedRate
์ํ์ธ ์ฑ๋ก ๋ฉ์ถฐ์ ์ฌ์์ ํ์ง ์๋ ๊ฒ ๊ฐ์๋ค.- ์ด๋
reasonForWaitingToPlay๋ฅผ
์ถ๊ฐ๋ก ๊ด์ฐฐํด๋ณด๋evaluatingBufferingRate์์
๋ฉ์ถฐ์ ๋์ด์ ์ํ๊ฐ ๋ฐ๋์ง ์์๋ค.
๊ทธ๋์ ๊ตฌ๊ธ๋ง์ ํด๋ณด์๋๋ฐ... AVPlayer์ ์์ฒด์ ์ธ ๋ฒ๊ทธ์ธ ๊ฒ ๊ฐ์๋ค. ๋น์ทํ ํ์์ ๊ฒช๋ stackoverflow ๊ธ๋ค์ด ๋ช๊ฐ๊ฐ ์กด์ฌํ๋ค.
- ios avplayer indefinite waitingToPlayAtSpecifiedRate
๊ทธ๋์ play()
๋ฉ์๋๋ฅผ ํธ์ถํ๊ธฐ ์ ์ ์๋์ ๊ฐ์ด ๋ก์ง์ ์์ ํ์๋ค.
AVPlayerItem
์ ๋ค์ ์ด๊ธฐํํ๋ค.replaceCurrentItem(with:)
๋ฉ์๋๋ฅผ ์ฌํธ์ถ์์ผ์ค๋ค.
์ผ๋จ ๋ฌธ์ ๋์๋ ๋ฌดํ๋ก๋ฉ ํ์์ ์ฌ๋ผ์ก์ง๋ง, ๊ฐํ์ ์ธ ํ์์ด์๋์ง๋ผ ์ด๊ฒ ์ ํํ ์์ธ์ธ์ง๋ ์ ํ์
์ด ๋์ง ์๋๋ค.
ํ์ง๋ง ์ผ๋จ ์ค๋ ํ
์คํธํด๋ณด์์ ๋, ๋์ด์ ๋น๋์ค๊ฐ ์ฌ์๋์ง ์๋ ํ์์ ์ฌ๋ผ์ ธ์ ์ด๊ฑธ๋ก ๋ง๋ฌด๋ฆฌํ๊ธฐ๋ก ํ๋ค!
- ์ฐธ๊ณ ๋งํฌ
- https://stackoverflow.com/questions/36858988/avplayer-does-not-fire-playbackbufferempty-but-does-not-play-either
- https://developer.apple.com/documentation/avfoundation/avplayer/timecontrolstatus/waitingtoplayatspecifiedrate
- https://developer.apple.com/documentation/avfoundation/avplayer/waitingreason/1643489-evaluatingbufferingrate