New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 30 users

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

Videos on Android do not play when the src is set as a blob via create URL

Project Member Reported by paulkinlan@chromium.org, Jun 24 2013

Issue description

Version: 28.0.1500.4
OS: Android 4.0.4+

What steps will reproduce the problem?
1. Dowload a video via XHR
2. Create a Blob URL from the data
3. Assign it to the video

What is the expected output? What do you see instead?

I would expect the video to play, instead it does not.  The play button appears and the correct events fire but the video just stays blank.

Example: http://jsbin.com/uyehun/1/edit

It works as expected on Desktop, just not on Android.

We have a lot of developers using this method to download videos, audio and images for offline storage and it needs to work for them.

Please use labels and text to provide additional information.
 

Comment 1 by vinodkr@google.com, Jun 28 2013

Owner: qin...@chromium.org
Status: Assigned
Hi there,
Can we hope this to be fixed? Not pushing, just asking because it would be very useful to me and I guess I'm not the only one...
Cheers,
also looking forward for that awesome feature to be fixed.
Thanks guys!
I think there are 2 work arounds:
1. Media source extension, Which is supported from Chrome 30.
2. The latest TOT build should support data uri for video. You can try building the content_shell to get this support, and see if it satisfies your needs. 

Comment 6 by qin...@chromium.org, Jan 21 2014

Status: Fixed

Comment 7 by k...@gmx.net, Apr 29 2014

Hi,
which Chrome App-Version and Android version will contain this fix?

I´ve tried the above jsbin-link on Android version 4.4.2 with Google Chrome App-Version 32.0.1700.99 and Google Chrome Beta App-Version 33.0.1750.70.

In neither of these two browser versions this does work.


Best Regards
Kai

Comment 8 by qin...@chromium.org, Apr 29 2014

I think it is in Chrome 34

Comment 9 by k...@gmx.net, Apr 30 2014

I updated to the latest browser versions on my Nexus 10:
 - Chrome (34.0.1847.114)
 - Chrome Beta (35.0.1916.69)
 - Android Version 4.4.2

I saw in your code changes, that there are changes in Adroid as well (media_player_bridge.cc).
Is this maybe the cause that it still does not work on Android?


Thanks,
Kai
that's chromium change, shouldn't matter with your android version

Comment 11 by k...@gmx.net, Apr 30 2014

Does it work for you on Android, and when it does, what Chrome version are you using?


Thanks,
Kai
Cc: kinuko@chromium.org michaeln@chromium.org
This works in versions <= 34.0.1847.73, but got broken in versions >= 34.0.1847.75. (or between 35.0.1885.0 - 35.0.1887.0)
However, I was not able to identify the CL that is causing this from all the change descriptions.
The problem is that the DataItem we got from BlobDataHandle no longer contains the path information. 

@michaeln, @kinuko, any idea which change will cause this hehavior change on blob data so that we no longer get a file path in the cache directory?
ah... i think it is https://codereview.chromium.org/202143009 that breaks this.

Comment 14 by k...@gmx.net, May 12 2014

Hi,
any idea when this can be fixed again?

Kai
Hey,

Any progress on this? This feature is really interesting.
All the best!

Julien
This should work with chrome37 on android

Comment 17 by Deleted ...@, Oct 11 2014

In a related issue, saving an image to pouchdb, fetching it, and calling window.webkitURL.createObjectURL works on Chrome desktop but not my Chrome 38.0.2125.102 on Android 4.4.4. This works fine on the same Android with FF 32.0.3. With Android chrome..the tab opens and then quickly shuts and then a file is downloaded that Android can't open.

var url = createObjectURL(responseFromGetAttachmentPouchDb); //2mb image/jpeg
window.open(url, "blank"); //url = blob:baf53a3f-233d-439e-b79e-bbb04f27c022


function createObjectURL (url) {
  if ( window.webkitURL ) {
      return window.webkitURL.createObjectURL( url );
  } else if ( window.URL && window.URL.createObjectURL ) {
      return window.URL.createObjectURL( url );
  } else {
     return null;
  }
}
I am experimenting the same issue on Chrome 43.0.2357.93 / Android 5.1.1; Nexus 5
Still seeing this on Android 5.1 / Chrome 44 and even on the 46.0.2486.0 preview.  

Using Data URIs also fails with the same 0 byte partial content 206 response, even if I prime the blob by pulling it into an Image src with a successful 200.  Stylesheets loaded with blobs work fine. 

Attempting to dynamically generate an HLS, using the approach in below example code which worked fine on iOS and desktop Safari.

    var hls = [
        "#EXTM3U",
        "#EXT-X-TARGETDURATION:5",
        "#EXTINF:6,",
        "http://my.example.com/200k.split.0.ts",
        "#EXT-X-ENDLIST"
    ].join("\n");
 
    var blob = new Blob([hls], {type : 'application/x-mpegurl'});
    v.src= URL.createObjectURL(blob);

Here's what I could capture:

General
	.	Request URL:blob:http%3A//www.example.com/23d16874-5771-43f7-8364-f915259d5aa3
	.	Request Method:GET
	.	Status Code:206 Partial Content (from cache)

Response Headers
	.	Content-Length:2
	.	Content-Range:bytes 0-1/195
	.	Content-Type:application/vnd.apple.mpegurl
 Request Headers
	.	Provisional headers are shown
	.	Range:bytes=0-1
	.	User-Agent:Mozilla/5.0 (Linux; Android 5.1; XT1032 Build/LMY47M.M001) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36

Comment 20 by hae...@gmail.com, Aug 26 2015

I have the very same issue with Android 4.4 and Crosswalk 14 (Chromium 43). The video element does not seem to load anything from a blob object url.

Stephan
Cc: dmu...@chromium.org
Labels: Cr-Blink-Storage
Owner: ----
Status: Untriaged
Comment #12 suggests the media player on android requires a file path. If that's true, then thats the problem. Blobs are not guaranteed to be backed by a file.
Labels: -Cr-Blink-Storage Cr-Blink-FileAPI
Owner: qin...@chromium.org
Status: Assigned
qinmin@ - can you take a look?

Per #21, it's not the case that Blobs/Files will always be backed by a real file on disk. Is this the problem with some of these repros?

Cc: mcasas@chromium.org
How is this bug progressing? Stumbled upon it while working
on  http://crbug.com/561068 . I could repro with Sam's 
http://simpl.info/video/offline/,on ToT build (~ 363070ish) 

Comment 25 by horo@chromium.org, Jan 25 2016

Cc: horo@chromium.org

Comment 26 by horo@chromium.org, Jan 25 2016

Android Chrome's video element can't load the blob URL which is created for a local file.
Version: 47.0.2526.83
OS: Android 6.0.1
Demo: https://horo-t.github.io/tmp/20160125/video.html

    var fileInput = document.createElement('input');
    fileInput.type = 'file';
    fileInput.accept = 'video/*';
    fileInput.name = 'files[]';
    fileInput.addEventListener('change', (function () {
        var url = URL.createObjectURL(fileInput.files[0]);
        var video = document.createElement('video');
        video.autoplay = true;
        video.src = url;
        document.body.appendChild(video);
      }).bind(this), false);
    document.body.appendChild(fileInput);
    fileInput.click();

According to the log, MediaPlayerAndroid is failing to read the video file.

01-25 16:33:26.793  1428  1428 E FileSource: Failed to open file 'content://com.android.providers.media.documents/document/video%3A70911'. (No such file or directory)
01-25 16:33:26.798  1428  1428 E StagefrightMetadataRetriever: Unable to create data source for 'content://com.android.providers.media.documents/document/video%3A70911'.
01-25 16:33:26.798  9808  9926 E cr_MediaResourceGetter: Error configuring data source: setDataSource failed: status = 0x80000000
01-25 16:33:26.799  9808  9926 E cr_MediaResourceGetter: Unable to configure metadata extractor

Comment 27 by horo@chromium.org, Jan 25 2016

I think we should use MediaMetadataRetriever.setDataSource(Context, Uri) for "content" scheme.
https://codereview.chromium.org/1626283002

Comment 28 by horo@chromium.org, Jan 26 2016

Ah, #26 is just a bug in MediaResourceGetter.
MediaResourceGetter can't get the metadata from a video file with "content" scheme url.
But we can play the video when we set video.controls = true.
Project Member

Comment 29 by bugdroid1@chromium.org, Jan 27 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0a348eea7c984eca84abc6a6e96779d7d03f3ad5

commit 0a348eea7c984eca84abc6a6e96779d7d03f3ad5
Author: horo <horo@chromium.org>
Date: Wed Jan 27 14:55:08 2016

Use MediaMetadataRetriever.setDataSource(Context, Uri) for "content" scheme.

This cl will fix the bug reported at  https://crbug.com/253465#c26 .
With this patch, MediaMetadataRetriever can get the metadata of the local video file which is selected with the file input element.

BUG= 253465 

Review URL: https://codereview.chromium.org/1626283002

Cr-Commit-Position: refs/heads/master@{#371786}

[modify] http://crrev.com/0a348eea7c984eca84abc6a6e96779d7d03f3ad5/content/public/android/java/src/org/chromium/content/browser/MediaResourceGetter.java
[modify] http://crrev.com/0a348eea7c984eca84abc6a6e96779d7d03f3ad5/content/public/android/javatests/src/org/chromium/content/browser/MediaResourceGetterTest.java

Hi, when should this fix show up in Chrome Dev for Android?

Comment 31 by phistuck@gmail.com, Feb 16 2016

The fix for the issue reported in comment 26? It is already there.
Phistuck@ sorry I was not notified of your reply. Tnx.
I keep having problems with this. I tried it on a Nexus 5 with latest Chrome Dev and in fact it works.
I then tried it on my HTC One M8 (Android 6.0, tested both Chrome Dev 50.0.2652.3 and 50.0.2657.5) and it does not seem to work, meaning the video does not play. I am testing this using the simpl.info/mediarecorder app, so I record a video and then play it back.
I debugged and nothing shows up in the console.
Maybe it's just my phone having troubles but I think it's worth mentioning it here.
#32: IIRC, Webm sends a few small header chunks before
the encoded frame(s) and that chokes up the Android 
MediaCodec player. This can be seen, if my memory doesn't
fail me, in the `adb logcat` screen. 

Have you tried starting the MR with a timeslice (e.g. 
100ms)? -- this might only make a Blob of Blobs still having 
the small header pieces choking the player though, in that 
case a consolidation round in JS might be the only possible 
workaround. Which. Would. Suck :( 
#33: I will check in the logcat to see if that's happening. 
Regarding your suggestion, I'm not sure if I get it right.
So, let's say I implement the timeslice. That is supposed to solve the initial header chunks which choke MediaCodec. But, if that does not work, than the only solution is to take the whole recorded media, rework it in JS and then pass it to the player. Do I get it right?
Re. 34: Let me clarify :) When the timeslice is set in MR,  there's 
an internal BlobData where the recorded and multiplexed data 
gets accumulated [1]; this "super blob" is sent to JS when 
the appropriate time has passed. IIRC the Android player didn't 
like the small bits of the header, so a large enough timeslice 
should solve the problem, yes. Otherwise we need to look at the
logcat and see what's the (next) thing upsetting the Player.

[1] https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp&sq=package:chromium&type=cs&l=302&rcl=1456835474
Components: -Blink>Video Blink>Media>Video
Renaming Blink>Video to Blink>Media>Video for better characterization

Comment 37 by xingc...@gmail.com, Mar 28 2016

I tried on chrome 49.0.2623.105 , this issue seems fixed on it.
I am encountering the issue as well (Chrome 49.0.2623.105). I would be very happy to assist with any logs or whatever else to help debug the issue.

Comment 39 by phi...@satchel.com, Apr 12 2016

I have this issue as well by default, but if I enable the unified media pipeline my videos start working again.

Open chrome://flags and enable "unified media pipeline"
The problem I described in comment #32 seems fixed on my device as of Chrome Dev 51.0.2693.2 Android. 
Workaround: enabling "unified media pipeline" flag on 49.0.2623.105 and on dev (51) channel for Nexus 6. Tested on other devices. Can confirm workaround fixes issue on android 4.4.3+ using dev channel (51).
#c39: fix by way of flags resolves <video> and <audio> elements playback from blobs. Tested here: https://webrtc.github.io/samples/src/content/getusermedia/record/
the bug is still occurring on chrome 51 on android Galaxy Note 3. After the media recorder records the video and converts to a window.url. The desktop version of chrome plays the video but the mobile chrome refuses to play on the device. I have even tried to convert the blob object into a dataUrl by using the fileReader api and loading in the blob to read as data url and still no errors on mobile. 
#C43: Seconded. The bug persists on the Samsung Galaxy Note 3 (as well as the A3, S6, and S7 Edge+ devices to which I have access). This affects both the Chrome app and the system webview. Many people in the Cordova/Phonegap community are pulling their hair out over this one.
Fix appears planned for v52: https://bugs.chromium.org/p/chromium/issues/detail?id=507834

I have tested the "enabling unified media pipeline flag" workaround as suggested in #C41 in v51 and it works on my S7.
Labels: Needs-BlinkMediaTriage
Cc: qin...@chromium.org
Labels: M-52
Owner: dalecur...@chromium.org
Status: Fixed (was: Assigned)

Comment 48 Deleted

Labels: -Needs-BlinkMediaTriage
Components: Blink>Storage>FileAPI
Components: -Blink>FileAPI

Sign in to add a comment