Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7958901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:29:27+00:00 2026-06-04T04:29:27+00:00

I am trying to create an AVPlayer that will display a video file. This

  • 0

I am trying to create an AVPlayer that will display a video file.

This is the code I have so far:

- (IBAction) player {
       NSURL* m = [[NSBundle mainBundle] URLForResource:@"Cache" withExtension:@"mov"];
       AVURLAsset* asset = [AVURLAsset URLAssetWithURL:m options:nil];
       AVPlayerItem* item = [AVPlayerItem playerItemWithAsset:asset];
       AVPlayer* p = [AVPlayer playerWithPlayerItem:item];
       self.player = p;
       AVPlayerLayer* lay = [AVPlayerLayer playerLayerWithPlayer:p];
       lay.frame = CGRectMake(10, 76, 303, 265);
       [self.view.layer addSublayer:lay];
       [p play];
}

I have already linked to AVFoundation.framework and CoreMedia.framework and I have imported <AVFoundation/AVFoundation.h>.

First of all, I am getting an error that says property 'player' not found on object of type 'ViewController* (for the line self.player = p;). What do I need to do to get this to run?

Also after the error is fixed, will this code work correctly to display the video?

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:29:28+00:00Added an answer on June 4, 2026 at 4:29 am

    Your viewController obviously does not contain such instance variable.

    To fix that issue, add the following to your viewController header file (.h):

    @property (nonatomic, strong) AVPlayer *player;
    

    Then add the following to your viewController implementation file (.m):

    @synthesize player;
    

    The first step will ensure that your viewController object actually owns an instance variable named player. The second step will create a matching setter and getter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying create this function such that if any key besides any of the
I'm trying create a query that will output a total number, as well as
Hi I am trying create a system call that will count the number of
I'm currently trying create a service that will return results of a OLAP cube
I'm trying create simple application in C++. This application has to read from file
Trying to create a background-image slideshow and am getting this error... This is the
Trying to create a generic video plugin for Expression Engine 2 where I can
hi I'm trying create chat using node.js I see example in http://chat.nodejs.org/ I have
I'm trying create a box in my Django app that displays text (and possibly
I'm trying create a ASMX webservice that can perform a HTTP GET request. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.