2

I m Making the Application Where i need to select the time for video . after selecting the time period. video will play according to time.

so when video will start.time should start For example:: if i set 10 minutes and it should reduce like 9:59.

How can I implement this?

Can anyone please give me a sample example or a easy step by step tutorial that i can follow?

kb920
  • 3,039
  • 2
  • 33
  • 44
Inder_iOS
  • 1,636
  • 1
  • 12
  • 20

2 Answers2

0

Hi here you can manage video time conditionaly by getting current time with the selected total time to play video.

currentItem = player.currentItem;

CMTime userSpecificTime;//total time by user input
CMTime currentTime = currentItem.currentTime; //playing time

now you can compare this both the time when current time reach the user specified time during that you can stop the video.

here we can not trim the video by its length.

Hope it helps you.

Samkit Shah
  • 721
  • 1
  • 7
  • 18
0
#import <AVFoundation/AVFoundation.h>
AVURLAsset *avUrl = [AVURLAsset assetWithURL:[NSURL URLWithString:@"xxx"]];
CMTime time = [avUrl duration];
double seconds = ceil(time.value/time.timescale);
Allen.Yang
  • 61
  • 3