Add videos to the simulator for iPhone Development

Source: Internet
Author: User

IPhoneDeveloped inSimulatorAddVideoYes, this article introduces the right content.VideoAddSimulatorThe iTunes synchronization method on the real machine is useless. CocoaChina member "castielyue" shared hisVideoAdd a project, place the video in the resource, change the video name in viewdidload, and add itSimulator. Download the attachment SaveVideo.zip (1068 K ).

The following functions are used here:

 
 
  1. UIVideoAtPathIsCompatibleWithSavedPhotosAlbum  
  2.  
  3. Returns a Boolean value indicating whether the specified video can be saved to user’s Saved Photos album.  
  4.  
  5. BOOL UIVideoAtPathIsCompatibleWithSavedPhotosAlbum (  
  6.    NSString *videoPath  
  7. ); 

Parameters

VideoPath

The filesystem path to the movie file you want to save.

Return Value

YES if the video can be saved to the photo album or NO if it cannot.

Discussion

Not all devices are able to play video files placed in the user's Saved Photos album. so, before attempting to save videos to the user's camera roll, you should call this function to ensure that saving the video is supported for the current device.

Corresponding, forwardSimulatorYou can use this function to add images.

 
 
  1. UIImageWriteToSavedPhotosAlbum  
  2. Adds the specified image to the user’s Saved Photos album.  
  3. void UIImageWriteToSavedPhotosAlbum (  
  4.    UIImage *image,  
  5.    id completionTarget,  
  6.    SEL completionSelector,  
  7.    void *contextInfo  
  8. ); 

Parameters

Image

The image to write to the user's device.

CompletionTarget

The object whose selector shocould be called after the image has been written to the user's device.

CompletionSelector

The method selector, of the target object, to call. This optional method shocould be of the form:

 
 
  1. - (void) image: (UIImage *) image  
  2.     didFinishSavingWithError: (NSError *) error  
  3.     contextInfo: (void *) contextInfo; 

ContextInfo

An optional pointer to any context-specific data that you want passed to the completion selector.

Discussion

The use of the completionTarget, completionSelector, and contextInfo parameters is optional and necessary only if you want to be notified asynchronously when the function finishes writing the image to the user's Saved Photos album. if you do not want to be notified, pass nil for these parameters.

Summary:IPhoneDeveloped inSimulatorAddVideoI hope this article will help you!

From: http://www.cocoachina.com/iphonedev/sdk/2010/1229/2520.html

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.