I am trying to play a video by setting src property of HTML 5 video tag to a Blob (using createObjectURL(blob) function). It seems to work fine on desktops but is not working on devices. Following is the flow of code:
- I have kept a .txt file which contains a video in Base64 format (Its a requirement, so can't change).
- On click of a button I load the .txt file using filesystem API and convert the Base64 string to Blob.
- Then create the url for the Blob using createObjectURL(blob).
- Set the url generated by createObjectURL(blob) to src property of video tag.
I have also attached listeners "onerror", "loadstart" and "loadedmetadata" for the video. "loadstart" and "loadedmetadata" events are fired on Android devices but video doesn't play after clicking the default control of video, whereas on IOS device "loadstart" and "loadedmetadata" events don't get fired.