Posts

Showing posts with the label Video

Can I Use Javascript To Dynamically Change A Video's Source?

Answer : Sure, You can set the src attribute on the source element: document.querySelector("#myVideoTag > source").src = "http://example.com/new_url.mp4" Or using jQuery instead of standard DOM methods: $("#myVideoTag > source").attr("src", "http://example.com/new_url.mp4"​​​​)​ Then you need to call the load method on the video element: videoElement.load() I have faced this problem several times and based on previous experience and digging I can suggest these options: replace video tag completely yes, just re-insert <video> element with new sources. It's straightforward, but effective approach. Don't forget to re-initialize event listeners. assign video URL to video.src this I saw a lot in answers here, on stackoverflow, and also in sources on github. var video = document.getElementById('#myVideo'); video.src = newSourceURL; It works, but you cannot provide browser opt...

Apple - Can I Stream Any Video Played With VLC Player To Apple TV?

Image
Answer : It's not using VLC (although it uses some of its components and should be able to open anything VLC can open), but it looks like there's a way to do this. It requires on-the-fly transcoding for formats the AppleTV doesn't support (essentially anything not .mp4 or .m4v), which means it may take a fair bit of CPU power on your Mac, especially for HD stuff. It also means that aside from files the AppleTV natively supports, you're not getting bit-perfect renditions of the files, it's a lossy translation, but if you have a decently fast Mac, it should be pretty good. The main tool you'll want is AirFlick. It's a pretty basic program that sends a URL to the AppleTV that tells it to open a stream from your computer. It also handles transcoding the non-native files. It's not very well documented; it looks like the latest versions use a built-in copy of ffmpeg for transcoding, but some of the resources around the web suggest that it may need VLC ins...

Android Can't Record Video With Front Facing Camera, MediaRecorder Start Failed: -19

Answer : I wrestled with this problem a bit today, too. First, make sure that your permissions are set up correctly. Specifically, to record video, you'll want: <uses-feature android:name="android.hardware.camera.front" /> <uses-feature android:name="android.hardware.microphone"/> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> Second, and this is the tricky part, this line from the tutorial does not work with the front-facing camera! mMediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH)); That signature for CamcorderProfile.get() defaults to a profile for the back-facing camera: Returns the camcorder profile for the first back-facing camera on the device at the given quality level. If the device has n...

Convert Video To Apng/png?

Answer : This sort of thing has been done before (with gif) using imagemagick. APNG is not an official file format - the PNG group doesn't support this extension. Even if you get this to work, you are likely going to have lingering issues. You should probably consider an animated gif, unless you have some reason you are forced to use png. Checkout the page on Video Handling. Also take a look at Animation Basics and Optimization. I appear to be able to convert avi to apng directly on linux, but it fails on windows. A work around on windows would be to convert the movie to a sequence of stills: convert test.avi frame%04d.png if you want to use ffmpeg, this will extract frames every 5 seconds: ffmpeg -i test.avi -y -ss 5 -an -r 1/5 frame%03d.png then making the animation by using the apng edit firefox plugin. mng never gained much support, but APNG apparently has some support these days (FF/Chrome/Safari); more than WebP (Chrome/Opera). Be sure to check for browser support fo...

Can't Play This Video. Android VideoView Mp4 Recorded By Android Device

Answer : Please refer below code snippet...problem was with the path declaration.. String uriPath = "android.resource://"+getPackageName()+"/"+R.raw.aha_hands_only_cpr_english; Uri uri = Uri.parse(uriPath); mVideoView.setVideoURI(uri); Thats it... I tried everything mentioned before but it turns out that internet permission is needed to play a mp4 file. <uses-permission android:name="android.permission.INTERNET" />

Correct Mime Type For .mp4

Answer : According to RFC 4337 § 2, video/mp4 is indeed the correct Content-Type for MPEG-4 video. Generally, you can find official MIME definitions by searching for the file extension and "IETF" or "RFC". The RFC (Request for Comments) articles published by the IETF (Internet Engineering Taskforce) define many Internet standards, including MIME types. video/mp4 should be used when you have video content in your file. If there is none, but there is audio, you should use audio/mp4 . If no audio and no video is used, for instance if the file contains only a subtitle track or a metadata track, the MIME should be application/mp4 . Also, as a server, you should try to include the codecs or profiles parameters as defined in RFC6381, as this will help clients determine if they can play the file, prior to downloading it.