iOS 8 - Videos and sound files won't play from home screen web app
iOS 8.3 fixes the bug. Videos are now playable from homescreen webapp, including from appcache.
ios 8: Bundle path changes
Refer Technical Note 2406 by Apple
The breaking change is
Beginning in iOS 8, the Documents and Library directories are no
longer siblings of your application's bundle.
Don't store full path/URL to your documents. Store the file name and always generate full path/URL with recommended approach.
Get the DocumentsDirectory URL
// Returns the URL to the application's Documents directory.
- (NSURL *)applicationDocumentsDirectory {
{
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}
Then you get path out of url and append the file name to generate full path.
Embedded YouTube videos in HTML5 standalone app iOS 8.3 opening YouTube app
I was sent this answer from the Apple Support Communities. All I had to do was to add '-nocookie' after youtube in the src of the iframe
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>HTML5 Video Standalone Test</title>
<style>
body {
margin:0;
}
</style>
</head>
<body>
<iframe width="700" height="394" src="//www.youtube-nocookie.com/embed/xspoREpBOhY?rel=0" frameborder="0" allowfullscreen></iframe>
</body>
</html>
It worked for me in my test app.
Can you autoplay HTML5 videos on the iPad?
iOS 10 update
The ban on autoplay has been lifted as of iOS 10 - but with some restrictions (e.g. A can be autoplayed if there is no audio track).
To see a full list of these restrictions, see the official docs: https://webkit.org/blog/6784/new-video-policies-for-ios/
iOS 9 and before
As of iOS 6.1, it is no longer possible to auto-play videos on the iPad.
My assumption as to why they've disabled the auto-play feature?
Well, as many device owners have data usage/bandwidth limits on their devices, I think Apple felt that the user themselves should decide when they initiate bandwidth usage.
After a bit of research I found the following extract in the Apple documentation in regard to auto-play on iOS devices to confirm my assumption:
"Apple has made the decision to disable the automatic playing of video
on iOS devices, through both script and attribute implementations.In Safari, on iOS (for all devices, including iPad), where the user may be on a cellular network and be charged per data unit, preload and
auto-play are disabled. No data is loaded until the user initiates it." - Apple documentation.
Here is a separate warning featured on the Safari HTML5 Reference page about why embedded media cannot be played in Safari on iOS:
Warning: To prevent unsolicited downloads over cellular networks at
the user’s expense, embedded media cannot be played automatically in
Safari on iOS—the user always initiates playback. A controller is
automatically supplied on iPhone or iPod touch once playback in
initiated, but for iPad you must either set the controls attribute or
provide a controller using JavaScript.
What this means (in terms of code) is that Javascript's play()
and load()
methods are inactive until the user initiates playback, unless the play()
or load()
method is triggered by user action (e.g. a click event).
Basically, a user-initiated play button works, but
an onLoad="play()"
event does not.
For example, this would play the movie:
<input type="button" value="Play" onclick="document.myMovie.play()">
Whereas the following would do nothing on iOS:
<body onload="document.myMovie.play()">
Related Topics
Random Glitchy Rendering of Svg on iOS/Wkwebview
No Such Module 'Fbsdkcorekit' Xcode 7.4
Uicollectionviewcompositionallayout - Center Items in Sections or Groups
Change Cell Height by The Content of The Textview Inside The Cell
Background Image Not Displaying Correctly in iOS
How to Fetch Images from Photo Library Within Range of Two Dates in iOS
Remove Duplicate Structs in Array Based on Struct Property in Swift
Detect Permission of Media Library iOS
Media Query Not Working for iPhone and Ipad
Disabling Allowsbackgroundlocationupdates (Cllocationmanager) Doesn't Work After Is Was Enabled
How to Select Table View Row Selection with Custom Checkbox Button
Fixed Background for Part of a Site (Div) in iOS
Ad-Hoc Distributed Application Failed to Launch in Time
Dateformatter Gives Wrong Time on Conversation