I'm having problems trying to play audios in HTML 5 with the tag.
The audio is recorded correctly with the media file with compresion plugin: https://github.com/remoorejr/cordova-plugin-media-with-compression, in the Documents folder, and I can even delete the files I created, so the filesystem is not the problem, I can write in the folder. Also I downloaded the data in XCode to check if the file was there, and it was, and also used the checkFile, with the File Plugin, and it says that exist.
But when I try to play any of that audios on the HTML5 player, I can't.
This is what I have in the HTML (I'm sure the audio file exist):
<audio controls="controls" id="audio" style="width: 80%;">
<source src="file:///var/mobile/Containers/Data/Application/LONG STRING HERE/Documents/audiofile.m4a" type="audio/mpeg" />
</audio>
I tried with cdvfile:/// and withouth the file:/// or cdvfile:/// just starting with "/var/etc..." none of them work.
Thanks in advance!!
Related
So basically I have a snippet which I mean to load a .m3u playlist into the audio element. The playlist is encoded as base64, loaded with data URI. However, it does not work.
<audio autostart="true" loop="false">
<source type="audio/mpegURL"
src="data:text/plain;base64,aHR0cDovL3ZpZXRjaHJpc3RpYW4uY29tL2F1L3RjLzAwMS5tcDMNCmh0dHA6Ly92aWV0Y2hyaXN0aWFuLmNvbS9hdS90Yy8wMDIubXAz">
</audio>
However, loading the same playlist with the traditional URL /playlist.m3u works in iOS. It does not work in Chrome, which is fine by me now.
<audio autostart="true" loop="false">
<source type="audio/mpegURL"
src="/playlist.m3u">
</audio>
The content of playlist.m3u:
http://vietchristian.com/au/tc/001.mp3
http://vietchristian.com/au/tc/002.mp3
The questions are:
Is it possible to apply .m3u in Safari loaded as data URL
Bonus: How can I achieve this in Chrome also?
I think the problem is in the MIME type of the data URL:
src="data:text/plain;base64,aHR0cDovL3ZpZXRjaHJp....
It should be data:application/x-mpegurl;base64,aHR..., but I have also noticed that on Apple devices the type needs to be another, resulting in data:application/vnd.apple.mpegurl;base64,aHR...
I have a Cordova application that I use to be able to link to mp3 and mp4 files relatively using a src like so:
../../Documents/videos/video.mp4
I just now updated my Cordova application to the latest version and these relative URLs don't work so I've been expermenting with other solutions.
It looks like if I use the cordova.file.documentsDirectory (iOS only) variable I can link to them that way but when I save references to these files in the database the GUID of the application changes and the URL is no longer valid when the app is rebuilt and relaunched.
I tried using cdvfile://localhost/persistent/ but this seems to only work for images and not video or audio files using HTML5 audio and video tags for playback.
Ultimately I could save the files with a variable that gets replaced at run-time but this is obviously not the preferred "solution." Something like [documentsfolder]/videos/video.mp4
How can I link to a persistent file location and have it work with images, audio files, and video files?
I would love to use the cdvfile url but have it work with mp3 and mp4 files.
Thank you.
You should be able to access any resource [[[NSBundle mainBundle]resourcePath]stringByAppendingPathComponent:#"www/[your path]"]
I am trying to play multiple files in one playlist with the wowza streaming server. I thought that I can manage this functionality with a SMIL file, but that didn't work either.
I don't know whether wowza is using the smil file only for bitrate swithing but the sequence didnt work for me.
The smil file is looking like this:
<smil>
<head></head>
<body>
<seq>
<video src="mp4:test1.mp4" system-bitrate="600000"></video>
<video src="mp4:test2.mp4" system-bitrate="600000"></video>
</seq>
</body>
When I replace the sequence tag with a switch tag, it only plays the second video and not the first one at all.
Is it even possible to create such stream where I will be able to play multiple video files defined in a smil file?
Thanks
from what I know, Wowza does not allow to join separate files into a single VOD stream.
i was building kind of special streaming proxy server for such purposes.
Now i am implementing a video playback on my site and for mobile devices i use HTML 5 video player:
<video src="/get_video.php/myfile.mov" controls width="400" height="250"></video>
In src attribute stored url to php file which output a contents of video file. MIME-type of file i don't know(it's dynamic) so i send content type header - application/octet-stream.
And my iPhone cant play this video: screenshot
So Question: How to force the player to play videos?
Thanks.
First of all, I recommend reading these resources on Video tags:
http://www.w3schools.com/tags/tag_video.asp
http://www.w3schools.com/tags/att_video_src.asp
https://developer.mozilla.org/en-US/docs/HTML/Element/video
As I understand, you have to specify in your MIME type a real video type (vs application/octet-stream). You mentioned that it's dynamic, however on the server side you know which file are you reading (so, you can figure out file format).
Supported types are:
video/mp4
video/webm
video/ogg
i want to create an epub reader with feature like play video and audio from my iphone app.
One more thing i would like to say that it will not a web based applicaton.
i mean to say that i dont want to use uiwebview.
please any body help me thanx in adv.
EPUB3 supports tag, http://idpf.org/epub/30/spec/epub30-overview.html#sec-multimedia
So you can embed video like this:
<video id="my_video_1" width="720" height="365" preload="auto" controls="true">
<source src="../Misc/my_video_1.m4v" />
</video>
And, H.264 or VP8 video codecs are recoomended.
http://idpf.org/epub/30/spec/epub30-publications.html#note-video-codecs
The epub format is wrapped as a zip file (you can just unzip it). There was a lot of discussion about it in this thread:
Reading ePub format
So you can just add the audio/video in the zip and then runnit locally using MPMoviePlayer. If you want to be able to actually show the book you must re-implement a web engine, as epub books uses HTML to diagram. So, as far as I know, the UIWebView is the easiest way to go.