2

I have a UIWebview which play video from the web . I would like it to work in background,so you hear the audio . I have set the background mode in info to play audio and airplay . I have set the session with :

 //allow music app delegate
    NSError *sessionError = nil;
    NSError *activationError = nil;
    [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error:&sessionError];
    [[AVAudioSession sharedInstance] setActive: YES error: &activationError];

I have read : Continue playing audio from html5 player when in iOS background mode

and i read UIWebView: HTML5 audio pauses in iOS 6 when app enters background

Which offers the same thing . But still , when i go to background, it stops playing the video/ audio.(iPhone 4, iOS7,Xcode 6 ).

Is there something else i can do ?

thank you .

Community
  • 1
  • 1
Curnelious
  • 1
  • 16
  • 76
  • 150
  • 1
    seems there is no solution and that iOS is stoping all activities inside the web view. the only solution i found was to resume playing when app goes background(using javascript), but this not works flawless because there is a 1-2 seconds stop, and its not stable. if anyone have any other solution to play youtube video, in the size that i set (not full screen), that can be played in background, please let me know . – Curnelious Sep 26 '14 at 12:44
  • Did you ever come up with a solution to this? I have tried / read everything I could find and have not been able to do it. – Jim May 13 '15 at 16:52

1 Answers1

0

I ended up solving this by calling a javascript function within the webview that starts playing the video again 250ms after the application pauses.

Jim
  • 181
  • 2
  • 9