How I got Cordova or Phonegap local html video playback working

I was working on a project recently where I had to create a Cordova Android app that could play video embedded in the “assets/www” directory. This proved to be quite challenging and it seems that there are a lot of hurdles to make this happen. There are many questions  on stackoverflow here and here , amongst many, regarding this issue and there are a lot of problems faced by developers as Android gets updated, with many new workarounds needing to be found.

For a while, I was able to use the Cordova Html5Video Plugin and it worked well, except there is a limited amount of video properties and events available and it is a little awkward, since videos have to be placed in a special directory, which are then placed in the sdcard partition of the device. When I tested this on my device, videos can be accessed from the device’s camera and video roll, which kind of begs the question why the user would watch the video in the app, if they can access the video clips directly outside. I am sure there are workarounds that can be applied in this case, but since this method stops working for me on devices above API 19, it feels kind of broken and messy.

I also was wanting to find a way to work with JSC3D to enable showing some 3D models in a Cordova application. Since JSC3D does not work unless the model is served over http, I was thinking that would it not be nice to have a mini server serving the files from inside the Cordova app? After working through a bit of Google magic, I found this project on Github, called Cordova-httpd, which is exactly what I was looking for.

Suddenly I realised that a lot of the problems with inline video in Cordova could be solved in the same way. One could create a folder for the video files and then serve them using the httpd server into the app. The only thing that would have to be modified were the src attribute of the video elements, which could be set at run time using the “deviceready” event of Cordova.

I have tested this on devices running Android 4.4 through to Android 5.1. So far so good. On older devices with Android versions prior to 4.4, I have tested this same method using Crosswalk API. I hope you find this information useful.

 

A simple checklist before updating your Android ROM

Initial Backup

  • Phone calls history
  • Messages history
  • Backup contacts (if not already in the cloud)
  • Write down backup authentication code for two-factor authentication of Google account

Pre-flash

  • Backup all apps (not Titanium backup)
  • Backup current ROM (Use Recovery mode)
  • Flash boot image

Let me know if there are others that I might be missing, but this is the checklist that I have used a number of times without any incident.

The new Macbook looks to the future but are we ready?

The new Apple Macbook is definitely a nod to the future. It combines the concept of wireless inter-connectivity, minimalist design and a multi purpose port into a beautiful looking portable machine. However, the question remains over whether having one port that does everything is a practical design decision in terms of everyday use for the users.

Who are these users?

People who will be using the new Macbook machine, will be similar to those who already use either ultrabooks or Macbook Air machines. They want portability, long battery life, reasonably good display, a decent keyboard and a “good enough” processor for general computing. Another class of people who might buy the new Macbook could be people who are already using their iPad or tablet for simple creation tasks, such as creating documents, simple photo editing, video editing, and others.

Generally, people buy a notebook because they need to input large amounts of text or are more comfortable using a device with a keyboard. While convertible devices are quite nice concepts, often the execution is not quite hitting the mark for me. Many devices like Microsoft Surface show some very promising features, but they generally are heavier, have shorter battery life, have small screens or lack comfortable keyboards. With Microsoft Surface in particular, it seems that it does not really replace a notebook for me, as the kickstand design means that I have to rest it on a flat surface when I want to type using its keyboard.

With the Macbook Air, I could comfortably type with the notebook perched on my lap (kind of like a laptop, really) and I don’t have to worry about the device tilting backwards because my knees don’t have extensions to support the kickstand. This is why I am partial to the Macbook Air and other ultrabook concepts. I own a Macbook Air that I purchased way back in 2012 and it has served me wonderfully over the years. The build quality is exceptional and the keyboard, while not the best I have used, is certainly amongst the best in its class. Above all, what I cherish the most about all my Apple-made portables is the best trackpad in any portables that I have ever used.

What do people do on a Macbook Air

Having a laptop that can virtually go anywhere with you without weighing you down is one of the best aspects of owning a Macbook Air. I can take it to the library for writing tasks, I can take it to a lecture hall for presentations and amongst many other uses, I can also take it to a photo or video shoot. The very portable machine has afforded it many uses where other full-sized laptop could be considered cumbersome.

The decent (my definition and yours may vary widely) processing power means that I have used it for some media-related tasks, such as editing photos in Photoshop, design work in Illustrator and even some lightweight video editing, 3D modelling with Blender and Sketchup and UI prototyping with applications such as Adobe Fireworks.

I feel that what makes my ultraportable machine super useful is the keyboard and the assortment of ports available. The various ports such as Thunderbolt, USB ports (one for mouse and one for storage?) and charging port have all been used at the same time and the SD card slot has certainly come in handy quite a few times.

The new Macbook

The new Macbook is a visionary decision on Apple’s part. It is a manifestation of a vision when data transfers will happen mostly wirelessly (wireless flash drive anyone?) and a lot of storage will live in the cloud. The laptop of the future does not need a lot of ports. The single USB port could also disappear when Apple or other manufacturers use wireless charging.

In the (near) future, our notebook computers will become more like our smartphones and tablets, where data will enter and exit the device via some form of network connectivity. However, until that vision becomes the norm, we all still need USB ports to store and transfer data, perform backups, share files and many other purposes.

The new Macbook will face a lot of criticism from both the rest of the notebook industry and end users. It will be very much like when the first Macbook Air was released. For the new Macbook to become the norm and the design to copy, it will take a lot shorter than the time it took the Macbook Air to become a de-facto industry standard in laptop design.