KirovBvulgaru / google-cast-sdk

Automatically exported from code.google.com/p/google-cast-sdk
0 stars 0 forks source link

improve media_player.js MPEG-DASH support #141

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This issue is intended to track media_player.js DASH support limitations 
discussed in the Google Cast Developers post here:
    https://plus.google.com/102923280312872341140/posts/gT3fLAPg1WS
where is it reported that the current version of media_player.js (0.3.0?) does 
not yet support MPDs that use SegmentTemplate elements.  Also, it doesn't seem 
to support Representation elements inheriting "codecs" attributes from their 
enclosing AdaptationSet elements (see below).

Even if there is no specific ETA, it would be very helpful to know more clearly 
which features of DASH are planned to be supported in the foreseeable future.

What steps will reproduce the problem?
1. Clone from github.com/googlecast the cast-custom-receiver, 
cast-support-media-server, and cast-sender-tool-sample projects, and set up as 
documented (including downloading the sample media ZIP file as described in the 
cast-support-media-server README).  Register app ID with URL that retrieves the 
cast-custom-receiver's sample_media_receiver.html.
2. If necessary, edit cast-sender-tool-sample's web_sender_tool.html to add 
MIME type mapping for .mpd files as described in this bug report:
    https://github.com/googlecast/cast-sender-tool-chrome/issues/2
3. Browse to web_sender_tool.html using Chrome with the Cast extension, 
initialize the API with the registered app ID, connect to a receiver registered 
for that (presumably unpublished) app ID, and then request load of media at the 
URL at which the sample MPD file is accessible (with CORS headers if necessary).

What is the expected output?

Sample video playing on selected receiver.

What do you see instead?

No video, and debugging session to receiver shows exception.  With the current 
version of the MPD, I get an exception like this:

Uncaught NotSupportedError: The implementation did not support the requested 
type of object or operation. media_player.js:2498
ce media_player.js:2498
qe media_player.js:2653
ue media_player.js:2790
g.open media_player.js:2773
g.ue media_player.js:2876

[Note that those lines numbers correspond to media_player.js with the Chrome 
debugger's pretty-printing enabled.]

The NotSupportedError is thrown on calls to addSourceBuffer on MediaSource with 
an empty codecs string, e.g. a 'type' argument of 'audio/mp4; codecs=""'.  The 
sample MPD does not have codecs attributes in its Representation elements, and 
it seems that media_player.js isn't inheriting codecs values from the enclosing 
AdaptationSet element.  If I edit the MPD file to copy the AdaptationSets' 
codecs attributes into the enclosed Representation elements in the MPD file, 
then these addSourceBuffer calls succeed.

But then I get a different exception (and still no video):

Uncaught TypeError: Cannot read property 'end' of undefined media_player.js:3144
g.updateSegmentRequestInfo media_player.js:3144
se media_player.js:2716
qe.Jc media_player.js:2737
g.Jc media_player.js:2761
g.ve media_player.js:2895

As reported in the above-mentioned Google+ thread, this error apparently occurs 
because media_player.js does not yet support MPDs that use SegmentTemplate—an 
in particular, it only supports MPDs with SegmentURL elements with mediaRange 
attributes?  (The TypeError/undefined does seem to be occurring near code that 
handles byte ranges.)

Original issue reported on code.google.com by peter.jo...@qrclab.com on 14 Feb 2014 at 8:14

GoogleCodeExporter commented 8 years ago
For the record, I've attached the modified version of the sample MPD which I 
used to get the TypeError described above.  In addition to copying the codecs 
attributes from the AdaptationSet elements to their contained Representation 
elements (to work around the NotSupportedError described above), I also removed 
BaseURL elements for the reasons described here:
    https://github.com/googlecast/cast-support-media-server/issues/1
and edited the audio codecs attribute to a value that seems to work with 
Chromecast and desktop Chrome on MacOS (I get no audio with the original value 
of "mp4a.0x40" on either of those platforms).

Note that with this MPD, I can play the sample video (and many other 
SegmentTemplate-constructed MPDs) on a Chromecast using a version of the 
dash.js "reference" library inside a custom receiver app (using the preview 
SDK, at least).  We would be happier, however, to use an officially-supported 
DASH library, engineered for the Chromecast runtime environment, because we 
have had to rewrite dash.js's control loop to work reasonably well on a 
Chromecast device.

Original comment by peter.jo...@qrclab.com on 14 Feb 2014 at 8:45

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you for your report and mpd file we can use for testing.  We'll work on 
adding this support soon.

Original comment by vadi...@google.com on 14 Feb 2014 at 9:24

GoogleCodeExporter commented 8 years ago

Original comment by anad...@google.com on 14 Feb 2014 at 9:35

GoogleCodeExporter commented 8 years ago
An update to

http://www.gstatic.com/cast/sdk/libs/mediaplayer/0.3.0/media_player.js

was pushed that added support for segment template and segment list.  You 
manifest should work once you change the audio codecs value to mp4a.40.2.

Original comment by vadi...@google.com on 20 Feb 2014 at 1:50

GoogleCodeExporter commented 8 years ago
Please let us know if your issue is still not resolved.

Original comment by anad...@google.com on 20 Feb 2014 at 8:08

GoogleCodeExporter commented 8 years ago
Thanks!  Just returned from vacation and have confirmed that the sample MPD now 
plays with the latest version of media_player.js (md5 
250cfc16dc3f17bd0f1a1f59bc74d055, is there a better way to identify versions?). 
 It works with the MPD attached to comment #1, and it also works with the 
codecs attributes removed from the Representation elements (so that the codecs 
are properly inherited from the enclosing AdaptationSet elements).  So, it 
appears that both issues of this bug report have been fixed.

[Indeed, the audio codecs attribute still needs to be "mp4a.40.2" instead of 
"mp4a.0x40", but I think that that is a bug in the sample media, which I 
mentioned in a comment here: 
https://github.com/googlecast/cast-support-media-server/issues/1#issuecomment-35
126556]

Unfortunately, I still can't play other SegmentTemplate-based MPDs that we have 
generated (and which play on Chromecast using the dash.js library), but I will 
try to find out more information and file a separate issue.

Original comment by peter.jo...@qrclab.com on 25 Feb 2014 at 5:23