ios-library icon indicating copy to clipboard operation
ios-library copied to clipboard

Streaming Video

Open EmrahKK opened this issue 10 years ago • 2 comments

Is there a specific way of streming video in owncloud ios library? I 'm using below code to stream video from our owncloud server.

@property (nonatomic, strong) MPMoviePlayerController *moviePlayerController; . . .

  • (void)openVideo { NSString* filePath = [self.videoItem.filePath stringByAppendingString:self.videoItem.fileName];

    // fileurl is full path of a video file like "http://xxxx.com/remote.php/webdav/video.mp4"

    NSURL* fileurl=[NSURL URLWithString:[[[BoxAPI sharedBoxAPI] serverUrl] stringByAppendingString:filePath]];

    NSLog(@"opening video at > %@",[[[BoxAPI sharedBoxAPI] serverUrl] stringByAppendingString:filePath]);

    self.moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL: fileurl];

    self.moviePlayerController.fullscreen = YES; self.moviePlayerController.movieSourceType = MPMovieSourceTypeFile; self.moviePlayerController.view.frame = self.view.bounds;

    [self.view addSubview:self.moviePlayerController.view]; [self.moviePlayerController play];

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:self.moviePlayerController]; }

-(void)videoFinished:(NSNotification*)notification { NSLog(@"Video end.."); }

but I'm getting

2014-09-09 09:40:42.491 ibb box[4021:60b] _itemFailedToPlayToEnd: { kind = 1; new = 2; old = 0; }

video does not play. I'm setting credidentals with

  • [[AppDelegate sharedOCCommunication] setCredentialsWithUser:[self user] andPassword:[self password]];

    method before making request. I couldn't find any solution to this. please help..

EmrahKK avatar Sep 09 '14 06:09 EmrahKK

To do that the server should provide us a way to obtain a direct URL to access to de the file without need athentication. Maybe you could open this on the core linking this issue.

javiergonzper avatar Sep 10 '14 17:09 javiergonzper

@nasli @EmrahKK It seems to be possible by passing the username and password directly with the http request.. check the implementation in android app https://github.com/owncloud/android/issues/592

supportreq avatar Nov 06 '15 08:11 supportreq