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 6041939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:44:05+00:00 2026-05-23T06:44:05+00:00

i am writing code to play video file in ownservices.m class in a method

  • 0

i am writing code to play video file in ownservices.m class in a method like this.

-(void)playVediofile:(NSString *)vedioFileName {

NSLog(@"playing vedio file ");
NSURL *movieUrl = [NSURL fileURLWithPath:
                   [[NSBundle mainBundle] pathForResource:vedioFileName ofType:@"mp4"]];

MPMoviePlayerController* myMovie=[[MPMoviePlayerController alloc] 
                                  initWithContentURL:movieUrl];

myMovie.scalingMode = MPMovieScalingModeNone;

myMovie.initialPlaybackTime = 2.0;

[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(movieFinished:) 
                                             name:MPMoviePlayerPlaybackDidFinishNotification 
                                           object:myMovie]; 

[self.viewcontroller addSubview:myMovie.view];

[myMovie play];

}

i am calling this method from ownservicesviewcontroller.m class like this In a button click event.

ownServices *obj = [[ownServices alloc]init];
        [obj playVediofile:@"Movie"];

i am getting audio of the video clip,but it did n’t display video.

but i am add MPMoviePlayerController view to viewcontroller.

i did n’t get why it is not displaying.

why i am doing in seperate classes is because my requirement is like that,need to maintain all the methods in ownservices class and call them from ownservicesviewcontroller.m

can any one please help me.

Thank you.

  • 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-05-23T06:44:05+00:00Added an answer on May 23, 2026 at 6:44 am

    You need to set the frame property of myMovie.view:
    e.g. you could set it to the parents bounds:

    myMovie.view.frame = self.viewcontroller.bounds;
    

    Besides this, please check your instance variable naming. It seems, that you named your view instance “viewcontroller”, which just is strange. If viewcontroller is really a UIViewController type, you would need to add the myMovie.view to the viewcontroller’s view property and not directly to the viewcontroller…

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

Sidebar

Related Questions

I frequently find myself writing code like this: List<int> list = new List<int> {
I'm writing code like this, doing a little quick and dirty timing: var sw
While writing code in a file that would comprise of PHP, HTML, CSS &
I'm writing code that looks similar to this: public IEnumerable<T> Unfold<T>(this T seed) {
I want to play around with some image manipulation code I'm writing, so I'd
My question is about writing a video file to the hard drive that is
I am writing a video player to play back frames captured by our ASIC.
I'm writing a database log4j appender in Play. On its append() method, it creates
I am creating a page which can play a video file with alternate plug-ins
I just switched from 1.2 to trunk (r15175 at this writing) to play with

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.