Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoplay-detection for video crashes on iOS7 when added to homescreen #1038

Closed
wibron opened this issue Sep 17, 2013 · 23 comments · Fixed by #1370
Closed

Autoplay-detection for video crashes on iOS7 when added to homescreen #1038

wibron opened this issue Sep 17, 2013 · 23 comments · Fixed by #1370

Comments

@wibron
Copy link

wibron commented Sep 17, 2013

When I add my app to the homescreen via Safari, it crashes when I open the app. If I uncomment the Modernizr script-tag the app doesn't crash.

My build-config:

{
  "classPrefix" : "",
  "options": [
    "setClasses",
    "testProp"
  ],
  "feature-detects": [
    "test/video/autoplay"
  ]
}

Tested on iPhone 4S, iPad Mini Wifi with iOS 7.0

@paulirish
Copy link
Member

can you report this at bugreport.apple.com ?

you should be able to get a error dump from the simulator too.

@patrickkettner
Copy link
Member

Also, would you happen to know which version of ios 7 this is? The GM, or one of the builds

@wibron
Copy link
Author

wibron commented Sep 19, 2013

@paulirish Actually, I can't reproduce this in the simulator. Crashes on iPhone 5 and 4S with the GM.

@stucox
Copy link
Member

stucox commented Sep 19, 2013

Any chance it's related to #945, i.e. trying to load an unsupported video format? iOS doesn't support Ogg either.

@patrickkettner
Copy link
Member

I really doubt it, since Modernizr.video.h264 should be working, but I will check out to make sure.

@ryanseddon
Copy link
Member

Confirmed to cause a crash made a test case so people can try it themselves.

Now for the interesting bit. Loading the test case in safari will trigger a dialog "The operation could not be completed". Now I'm pretty confident this is related to changes with mp4 playback on iOS7 and the fact it needs to meet certain requirements when encoding.

In order to successfully play MP4 files on iOS 7 iPad 4, iPad 3, iPad 2, iPad mini, MP4 files shall meet the following requirements:

  • H.264 video up to 720p, 30 frames per second, Main Profile level 3.1 with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio;
  • MPEG-4 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio.

Check this article for more details. I tried following the steps but the application fails on videos less than 1 second. If anyone else would like to try here is the test base64 string in mp4 format.

@ryanseddon
Copy link
Member

Ok found an mp4 that iOS7 likes and it doesn't crash see test case.

This test video is huge (245kb) so can someone create or re-encode a small one.

@wibron
Copy link
Author

wibron commented Oct 23, 2013

This seems to have been fixed in iOS 7.0.3. Does not crash anymore for me on iPad and iPhone.

@patrickkettner
Copy link
Member

Thats great news! So you are good to close this out, then?

@ryanseddon
Copy link
Member

Not quite. It doesn't crash but I still get a "The operation could not be completed" dialog message. We still need to re-encode the test base64 string with the newer encoding profile needed so the test will work without showing a dialog message.

@darcyclarke
Copy link
Contributor

I'm still seeing the warning appear. Is a fix for this as simple as @ryanseddon mentions, ie. just re-encoding the base64 strings? Would love for Apple to fix this but a temporary work-around seems quicker.

@patrickkettner
Copy link
Member

Its not so much reencoding as it is finding one that won't crash the parser.

@patrickkettner
Copy link
Member

@ryanseddon did you actually get that to work in base64? I can't get any base64'd file to work in this situation.

We could hack around this by adding a check for navigator.standalone, but that is ugly as sin

@patrickkettner
Copy link
Member

btw, did anyone file a radar ticket for this? There is definitely a bug in safari here

@ryanseddon
Copy link
Member

@patrickkettner they fixed the crash in a dot release (7.0.2 maybe). What they won't fix is the fact that we use an old codec profile for our base64 test video. I don't have the ability to re-encode the test video into the right profile that iOS7 will accept I'm 100% certain that this will fix the issue.

@patrickkettner
Copy link
Member

Oh! I misunderstood what you meant about reencoding. I'll mess with it more.

@patrickkettner
Copy link
Member

@ryanseddon i've been messing with this on and off, and I have never been able to find any video that doesn't cause this the "The operation could not be completed" message from popping up. Nothing crashes the parser anymore, but everything (including the base64 version of the video you mentioned before) I filled an issue with apple (openradar mirror here), but at this point, I am at a loss. I think the only thing we can do here is check for the navigator.standalone.

Also, Seem to have stumbled onto a separate ios bug - this file actually seems to trigger autoplay (ie the video prompt loads automatically, just triggers the above mentioned prompt)

@ryanseddon
Copy link
Member

I'm getting the "The operation could not be completed" when loaded in iOS7 safari with my test case when I load it for a second time. The first time on a fresh cache it doesn't show then subsequent times after that it does.

@patrickkettner
Copy link
Member

Is anyone able to test if this is still an issue on 7.1?

@patrickkettner
Copy link
Member

I tried it - issue still present on 7.1

@patrickkettner
Copy link
Member

Its fixed on iOS 8 beta! Huzzah

@wibron
Copy link
Author

wibron commented Jun 3, 2014

Wooah, finally! I don't have access to iOS 8 right now, but can someone confirm this is fixed?

@patrickkettner
Copy link
Member

checked on a few dev devices, and we look to be good. Is everyone cool if I just add a dev note about iOS 7? Doesn't really look like there is anything to do otherwise :/

ryanseddon added a commit that referenced this issue Jun 16, 2014
add a knownBug for iOS7 video autoplay, since its fixed in iOS8. Fixes #1038
patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this issue Feb 22, 2015
add a knownBug for iOS7 video autoplay, since its fixed in iOS8. Fixes Modernizr#1038
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants