videojs / video.js

Video.js - open source HTML5 video player
https://videojs.com
Other
38.18k stars 7.47k forks source link

unable to play flv files via video.js #1670

Closed propertunist closed 10 years ago

propertunist commented 10 years ago

for a while i was able to use video-js to play flash files (.flv) - however, on recent tests the same code now no longer plays the same files that previously played ok. the only changes that i am aware of are with the server OS and with the browsers being tested (chromium and firefox).

chromium 38 (gnu/linux) produces this (regardless of whether the 'type' is set to 'video/x-flv' or 'video/flv'):

VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) No compatible source was found for this video.

firefox 33.1 produces this:

Specified "type" attribute of "video/flv" is not supported.

if i download the file from the server directly and play it on my local OS, vlc plays it just fine. i found this thread on this topic from nearly 3 years ago!! and still this is an issue: http://help.videojs.com/discussions/problems/754-flv-videos-not-playing

anyone got a response / explanation here? thanks

propertunist commented 10 years ago

i just tested again with the techOrder option being added to the video tag:

"techOrder": ["html5", "flash"]

though that made no difference

mmcc commented 10 years ago

How are you serving the files? Sadly, this isn't quite as simple as "FLV doesn't work", since Flash has its own set of fun idiosyncrasies aside from oddities you can see in FLV sources. Here's a working FLV example.

Switching the tech order to html5 first isn't going to do anything here since Flash is required to play them back. If anything you'd want to reverse that (but that shouldn't matter).

mmcc commented 10 years ago

That was slightly out of date version of VJS in that example, so just to be sure, here's the same example using 4.10.

propertunist commented 10 years ago

i am serving the files via nginx and the elgg framework (www.elgg.org). unfortunately i have not found a way of successfully exposing any streamable formats from within the elgg filestore structure, except for flv, so i am converting all videos that are hosted on my server to flv for web playback. what is the suggestion here? does a set of encoding parameters exist that are guaranteed to be successful for flash playback in videojs? i would prefer not to use flash, but i looked for quite a while for a solution and did not yet find one (having spoken with the coders of nginx and also of elgg). :( thanks

mmcc commented 10 years ago

Ah I thought your username was familiar: #1344 :)

I would highly, highly suggest not switching everything over to FLV if there's any way you can avoid it. It seems like the problem is still the same as it was in #1344....I don't think this has anything to do with the source format, I think it's Elgg. Try serving one of those files directly from nginx and see if it plays back.

What's the need to serve these things FROM elgg anyway? This just looks like a social networking plugin (from the 10 seconds I sent on their site). It doesn't seem like it's designed to deliver media, so why not just have media files uploaded to something like S3 and serve them from there (keep in mind I know nothing about elgg, so my apologies if that's ignorant)?

propertunist commented 10 years ago

the flash file is available to the browser in as much of an appropriate way as is possible, so much so that it has worked correctly previously. at some point in the last few weeks something changed. i just tested a flash file locally by copying it to an exposed location on the fileserver and then pointed the video.js player direclty to that file (so there is no elgg file management involved in serving the file) and i am seeing the same error codes in the browser. so i don't know how elgg could be involved in this problem. maybe the issue is an incompatible configuration of the codecs and other paramaters of the flash file?

elgg is a php framework that is focussed on making social networks. the need to serve the files from within elgg is that elgg provides security/privacy levels for files that it serves, so if i bypass elgg (as i did look at doing) then i lose the security too.

mmcc commented 10 years ago

When you're testing the file locally, are you setting up a local webserver? Playing back flash from the file://protocol can be problematic. Mind just pointing me to an example FLV somewhere that I can test with?

Understandable regarding the permissions bit. You might be able to use something like CloudFront signed URLs, but my guess is that would require quite a bit of modification to Elgg.

mmcc commented 10 years ago

Better yet, if you've got a second, mind putting together a JSBin for us try and help debug? Keep in mind JSBin doesn't work well with Flash when you're in edit mode, so you'll need to view it in the Live Preview to view the Flash player.

You can access the Live Preview by clicking the arrow to the far top right of the preview panel:

live preview button

propertunist commented 10 years ago

i am testing locally on nginx, not via a file:// type of link. so i just uploaded a small flv file both through elgg and also manually into a public location on the filesystem. this time, when testing through the JSBin, the one that is running through elgg failed and the manually uploaded one plays ok. the playback in elgg appears to be intermittently failing (moreso than not). the link for the file that is running through elgg is:

https://www.ureka.org/file/download/9660/bush%20caught%20lying%20about%20september%2011th%20-%20youtube%20%5B360p%5D.flv

and the same file as a direct file is:

http://www.ureka.org/mod/multimedia/Bush%20Caught%20Lying%20About%20September%2011th%20-%20YouTube%20%5B360p%5D.flv
mmcc commented 10 years ago

Yep, seems like that source works fine...When I try to access the video running through elgg I just get redirect to Ureka.org, so I can't debug headers or anything along those lines.

Not really sure what we can do for you here, since we really can't do anything to help from the Elgg side and it appears that VJS can playback the source without any issues.

propertunist commented 10 years ago

when i access the elgg link in firefox here i am presented with the option to download or open the file, not redirected.. not sure why there is an inconsistency there. hmm.. i will continue to explore this here.

propertunist commented 10 years ago

ah yes, chromium forwards to the homepage and firefox serves the file! weird

Ahmedhaseeb commented 9 years ago

i am using vjs 4.12.7 can any one tell me how can i play flash video. i search a lot over google and did not find solution.

mmcc commented 9 years ago

You just need to specify video/x-flv as the type, but otherwise it should just work (assuming you have the SWF set up correctly). Example

Ahmedhaseeb commented 9 years ago

what i am doing. I just add this in the head

 http://vjs.zencdn.net/4.12.7/video-js.css" 
          http://vjs.zencdn.net/4.12.7/video.js

And This After The Video Tag

         videojs( '#main_video', { plugins : { resolutionSelector : {

                default_res : "360"
            } } } );

I am also using resolution selector plugin.

When click on 240p (video/x-flv) resolution it does not play and this video source directly play into my browser.

You Can See This Live Here

http://ytube.getintoworld.com/embed.php?id=ip_0CFKTO9E

When you try to change it to 240p You Will See This Error in console

VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) FLASH: srcnotfound Object { code=4,  message="FLASH: srcnotfound",  MEDIA_ERR_CUSTOM=0,  more...}

Sorry for bad english

propertunist commented 9 years ago

i just returned to video.js and now the new version has fixed some of the errors i was experiencing before - so thanks. however, i now have a variation on this flash issue.

essentially, if i view this flash video (http://test.ureka.org/file/view/8064/fluoride) in firefox 39 on win 7, the video.js plugins i am using fail to load (although the video does play) and in the console i see:

Specified "type" attribute of "video/x-flv" is not supported. Load of media resource http://test.ureka.org/file/download/8064/shocking government coverups hiding fluoride_s connection t.flv failed.
All candidate resources failed to load. Media load paused.
TypeError: The element or ID supplied is not valid. (videojs)

other video formats appear to be playing ok so far.

hemanik commented 7 years ago

It still isn't working for me. Can someone put latest working example for this ?

kkkkkcnm commented 7 years ago

@mmcc demo not work

kkkkkcnm commented 7 years ago

@mmcc I would like to use video.js broadcast flv format live stream。 how can i do it ?

barriber commented 7 years ago

I encounter the same problem and all examples in this thread show the same error, Is there any solution for it?

mister-ben commented 7 years ago

If you're using Video.js 6.x, the Flash tech is no longer included by default. You need to add videojs-flash if you do need it.

Even when you have the Flash tech available browsers are making it increasingly difficult to use Flash, disabling it by default. You need to plan to not be reliant on Flash to play video.

There is an flv.js project to play FLV with Media Source Extensions, but this still won't play on iOS as it lacks MSE support. There's a plugin to use flv.js as a Video.js tech.

On the whole it's best to get away from FLV completely to a modern format. VOD could be transcoded/transmuxed to MP4/h265. For live streams use HLS.