I have created player in iOS. It works well for URLs such as mp4 and m3u8.
But I have one webm extension URL. AVPlayer is not working for this.
Sample url:
http://images.all-free-download.com/footage_preview/webm/dead_trees_146.webm
Is there any reason? Or can we make something possible to play this url?
From the apple docs:
iOS supports many industry-standard video formats and compression standards, including the following:
H.264 video, up to 1.5 Mbps, 640 by 480 pixels, 30 frames per second, Low-Complexity version of the H.264 Baseline Profile with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
H.264 video, up to 768 Kbps, 320 by 240 pixels, 30 frames per second, Baseline Profile up to Level 1.3 with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
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, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
Numerous audio formats, including the ones listed in Audio Technologies.
It doesn't support WebM. You may try using a library like OGVKit to play WebM videos.
Related
We've a demo video provided by design team with three different dimension (1024*768), (2048*1536) and (2732, 2048). I'm trying to pick proper video based on current device resolution (supported format).
For eg: If it its first generation iPad its resolution is (1024 * 768) it can play video format upto 720p more than that it will not play, likewise iPad3 (Retina) resolution is (2048 * 1536) but it can play video format upto 1080p. Similar iPad pro I guess it will play upto 4k videos.
I afraid system will not pick proper video on its own if we name it to 1x, 2x or 3x like in image.
If we are passing high dimension video to low resolution devices it is not playing. So what is the general approach in iOS to pick proper video based on its support format.
If you did have the option to stream from a server then HLS streaming and the media player would take care of selecting the best bit rate for the device and the current network conditions.
If not then, as far as I am aware, iOS does not support different video resolutions in the same way it does images as you note above.
You can still do this yourself by querying the device resolution and choosing the appropriate video at run time based on the result. To query the screen size:
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
CGFloat screenHeight = screenRect.size.height;
See here for the source of the above and for handling split screen mode: https://stackoverflow.com/a/5678199/334402
You will have to include multiple versions of your videos which will increase you bundle size, but, again, if you could stream instead you would avoid this.
To find a particular devices capabilities takes a little effort.
Firstly, you will commonly see quoted the general iOS video support information that apple provides:
iOS supports many industry-standard video formats and compression standards, including the following:
H.264 video, up to 1.5 Mbps, 640 by 480 pixels, 30 frames per second, Low-Complexity version of the H.264 Baseline Profile with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
H.264 video, up to 768 Kbps, 320 by 240 pixels, 30 frames per second, Baseline Profile up to Level 1.3 with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
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, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
Numerous audio formats, including the ones listed in Audio Technologies
As you point out, however, this is not the full story as different devices have different capabilities. To find the video supported for a particular devices you need to look at the info on the device tech specs page here: https://support.apple.com/specs/
For example for a first generation iPad it shows:
TV and video
Support for 1024 by 768 pixels with Dock Connector to VGA Adapter; 576p and 480p with Apple Component AV Cable; 576i and 480i with Apple Composite AV Cable
H.264 video up to 720p, 30 frames per second, Main Profile level 3.1 with AAC-LC audio up to 160 Kbps per channel, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; 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 in .m4v, .mp4, and .mov file formats; Motion JPEG (M-JPEG) up to 35 Mbps, 1280 by 720 pixels, 30 frames per second, audio in ulaw, PCM stereo audio in .avi file format
And for iPad 5th generation it shows:
TV and Video
AirPlay Mirroring, photos, audio, and video out to Apple TV (2nd generation or later)
Video mirroring and video out support: Up to 1080p through Lightning Digital AV Adapter and Lightning to VGA Adapter (adapters sold separately)
Video formats supported: H.264 video up to 4K, 30 frames per second, High Profile level 4.2 with AAC‑LC audio up to 160 Kbps, 48kHz, stereo audio or Dolby Audio up to 1008 Kbps, 48kHz, stereo or multichannel audio, in .m4v, .mp4, and .mov file formats; 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 per channel, 48kHz, stereo audio or Dolby Audio up to 1008 Kbps, 48kHz, stereo or multichannel audio, in .m4v, .mp4, and .mov file formats; Motion JPEG (M‑JPEG) up to 35 Mbps, 1280 by 720 pixels, 30 frames per second, audio in ulaw, PCM stereo audio in .avi file format
To actually detect the device there seems to be some discussion around the best way, but it looks like someone is keeping this approach here more or less up to date: https://stackoverflow.com/a/10481095/334402 (it includes up to iPad 4 and iPhone 6 at the time of writing)
I created a working solution for this problem by embedded m4v video data inside a PNG and then decoding and resaving the .m4v file in the tmp dir on device. Have a peek at this SO answer for details: https://stackoverflow.com/a/56383999/763355
Using react-native-video to play a simple video it fails at resolutions greater than 1024x768 on older devices (ipad 2, ipad 3rd gen (A1416)) with the error below.
{
"target": 4,
"error": {
"code": -11855,
"domain": "AVFoundationErrorDomain"
}
}
I can't find this error in the list of AVFoundation error constants. It stops at -11852.
I have found through testing that the maximum resolution I can use on 2nd or 3rd gen ipads is 1024x768, but I can't find this documented anywhere. An ipad mini 2 can play video at 2048x2048 without trouble.
What resolution can I use that will work with all iPads?
Can I display different media like 1x and 2x images on iPads that have different capabilities?
iPad 2 has the following specifications:
Video formats supported:
H.264 video up to 1080p, 30 frames per second, High Profile level 4.1
with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4,
and .mov file formats;
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 per channel, 48kHz,
stereo audio in .m4v, .mp4, and .mov file formats;
Motion JPEG (M-JPEG) up to 35 Mbps, 1280 by 720 pixels, 30 frames
per second, audio in ulaw, PCM stereo audio in .avi file format
Source: https://support.apple.com/kb/sp622?locale=en_GB
iPad 3 has the following specifications:
Video formats supported:
H.264 video up to 1080p, 30 frames per second, High Profile level 4.1
with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4,
and .mov file formats;
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 per channel, 48kHz,
stereo audio in .m4v, .mp4, and .mov file formats;
Motion JPEG (M-JPEG) up to 35 Mbps, 1280 by 720 pixels, 30 frames per
second, audio in ulaw, PCM stereo audio in .avi file format
Source: https://support.apple.com/kb/sp647?locale=en_GB
As you can see, it doesn't support resolution greater than 1080p i.e. 1920 by 1080 so 2048 by 2048 won't work.
-18555 error description is in file AVError.h (https://developer.apple.com/reference/avfoundation/averror/averrorundecodablemediadata)
AVErrorUndecodableMediaData NS_AVAILABLE(10_10, 8_0) = -11855,
Though there is not enough description given to give a concrete conclusion but from the name we can say that it means it cannot decode the video as it's beyond device capability.
I have a .h264 file in my project bundle and i have to play it. I searched for long time and everybody suggested FFMPEG but there is no proper guidance. In another way at least suggest me how to convert this .h264 file in to .mp4 file programmatically by that way at least i can depend on MPMoviePlayer. Please suggest me.
Thank you.
Use the native AVFoundation framework
https://developer.apple.com/av-foundation/
iOS supports many industry-standard video formats and compression standards, including the following:
H.264 video, up to 1.5 Mbps, 640 by 480 pixels, 30 frames per second, Low-Complexity version of the H.264 Baseline Profile with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
H.264 video, up to 768 Kbps, 320 by 240 pixels, 30 frames per second, Baseline Profile up to Level 1.3 with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
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, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats
Numerous audio formats, including the ones listed in Audio Technologies
In order to get > 10 minute videos on my app accepted, I need to implement a html5 video in a webview. The video is linking as I can hear the audio but the video is a black screen. The videos are all mp4 and I am using the following html
<html><body style="margin: 0; padding: 0;"><video width="480" height="300" controls="controls"><source src="'+video+'" type="video/mp4"></video></body></html>
can anyone help me get my imagery viewing?
I am going to guess that it is the video format that is the issue.
Here is what is suported:
H.264 video up to 720p, 30 frames per second, Main Profile level 3.1
Audio: AAC-LC up to 160 Kbps, 48kHz, stereo
File types: .m4v, .mp4, and .mov
MPEG-4 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile
Audio: AAC-LC up to 160 Kbps per channel, 48kHz, stereo
File types: .m4v, .mp4, and .mov
Miro might help you out, since it has a "for iphone" option that sets up the video just right.
We currently have a system working on chrome,ie7 and mozilla. We have jwplayer that plays .flv videos on these browsers. We have now to support the play of videos in ipad. Will it be possible if we upgrade the jwplayer to version 5 which supports html5 video tags. Will html5 video tags in ipad be able to support play of .flv files?
The jwplayer works fine on the iPad but you will need another video type for ipad support. The iPad will not play FLV file types, as shown on the iPad Video specs page:
Video formats supported: H.264 video up to 1080p, 30 frames per second, High Profile level 4.1 with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; 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 per channel, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; Motion JPEG (M-JPEG) up to 35 Mbps, 1280 by 720 pixels, 30 frames per second, audio in ulaw, PCM stereo audio in .avi file format