IOS: multimedia (18-01-25), ios multimedia 18-01-25

Source: Internet
Author: User

IOS: multimedia (18-01-25), ios multimedia 18-01-25

1. Audio

2. Video

1,

2. AVPlayer

 

1. Audio

 

 

 

 

2. Video

1,

 

 

2. AVPlayer

0) write in front

AVPlayer mainly includes AVPlayer, AVPlayerItem, and AVPlayerLayer, which correspond to Controller C, Model M, and view V respectively.

1) AVPlayer (Controller C)

 

2) AVPlayerItem (Model M)

2-1). Video duration:

AVPlayerItem. duration is CMTime type

Typedef struct {CMTimeValue value; // Number of frames CMTimeScale timescale; // Frame Rate (several frames per second) CMTimeFlags flags; CMTimeEpoch epoch;} CMTime;

The total number of seconds of the Video = duration. value/duration. timeScale.

OR = CMTimeGetSeconds (AVPlayerItem. duration ).

2-2) jump to a certain time point

CMTime time1 = CMTimeMake (120, 60); CMTime time2 = CMTimeWithSeconds (2.0, 1); [self. avItem seekToTime: time1 completionHandler: ^ (BOOL finished) {// after the jump is complete}];

Both CMTimeMake and CMTimeWithSeconds jump to the first parameter/second parameter = 2 seconds.

I personally think the difference between the two is to give developers a reference object, for example:

The first function, CMTimeMake, knows the number of frames per second and jumps to the specified number of frames.

The second function, CMTimeWithSeconds, knows the number of seconds to jump to and then sets the second parameter.

          

          

 

 

3) AVPlayerLayer (view V)

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.