xcode5 - Video slow motion using AVPLAYER in Cocoa Aplication -


i'm going start video slow motion using avplayer in cocoa application. example: can select start position , end position video. if play again video want slow motion start , end position . 1 please tech me how implement that. how select start position , end position , slow motion using avplayer.

you'll need add time observer player - addperiodictimeobserverforinterval:queue:usingblock:. called on regular intervals specify. you'll use know when player reaches start or end positions.

for start , end positions have store them somewhere in code , compare them in block of method. take in mind observer needs cmtime , many people bit confused it. here answers:

i prefer work cmtime instead of seconds it's you.

then slow motion need set rate property of player whatever need - 0.5 make twice slower original speed, 0.25 make 4 times slower etc. value of 0 pause playback , value of 1 play normally. negative values same difference playback go reversed (towards begging) , values higher 1 (or -1) set playback faster normal.

so... while observing playback once currenttime property of player (or time parameter block) between start , end position set rate desired one. when currenttime out of range set rate 1 , video plays normal speed.

this is, think, easiest way. can use compositions , scale time ranges it's more complicated , if play video , don't need process afterwards think it's better stick simpler solution.

hope helps i'd suggest read more docs because avfoundation great framework unlimited possibilities there important things shouldn't miss when dealing it.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -