mp4box.js icon indicating copy to clipboard operation
mp4box.js copied to clipboard

Simple example for browser

Open pagodzik opened this issue 3 years ago • 1 comments

Hi

I have a problem with some videos with some codecs. I'm trying to use mp4box to check which codec doesn't work. But I don't understand how to do this.

My code:

			var mp4boxfile = MP4Box.createFile();
			mp4boxfile.onReady = function (info) {
				console.log("MP4BOX: Received File Information");
				console.log(info);
			}
			mp4boxfile.onError = function (e) {
				console.log("MP4BOX: Received Error Message "+e);
			}

			var newVid = document.createElement('video');
			$(newVid).attr({
				id:'videoElement' + videoElementId,
				src:localFilesPath + videoElementId,
				muted:true,
				autoplay:true,
				});
			$(newVid).appendTo('#container');
			
			videoPlayer = window.player = $(newVid);

Video plays but there is no info from mp4box. How should I get it? I checked demo, but I think that there are old version of script (with 'new MP4Box').

The most interesting thing for me - I wish to know info about video which not plays (on error event is called), how can I got these info?

videoPlayer.on('error', function(e) {
	console.log('video is broken');
	console.log(e);
	console.log(videoPlayer);
});

pagodzik avatar Feb 26 '21 10:02 pagodzik

Not sure which demo uses "new MP4Box", the demos here should all use MP4Box.createFile. Let me know if this is not the case. Regarding checking codecs value is supported, you can have a look at https://cconcolato.github.io/media-mime-support/

cconcolato avatar Aug 19 '21 23:08 cconcolato