videojs / video-js-swf

Custom Flash Player for VideoJS
http://videojs.com
Other
336 stars 312 forks source link

Pseudo Streaming - seek ahead of buffer in Flash #13

Closed doublex closed 8 years ago

doublex commented 11 years ago

Webserver-modules like "ngx_http_mp4_module" or "mod_h264_streaming" allow Flash-clients to seek a video beyond the downloaded buffer line, using a "start"-parameter, e.g.: http://server.com/path/to/video.mp4?start=10

The article about JWPlayer mentions this feature: http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/12534/video-delivery-http-pseudo-streaming

Thanks a lot Markus

other keywords: byte range request

shir commented 11 years ago

Any updates on this feature?

heff commented 11 years ago

No, no one's stepped up to implement this yet, and we've got HLS and RTMP ahead of it on the priority list.

mariolorente commented 11 years ago

The only thing you can do is adding a flv source to the video so flash is able to seek it..

foxx commented 11 years ago

Any news on this? I would have tried to fix myself, but my flash skills are terrible.

lazarolemos commented 11 years ago

Hi, any news?

heff commented 11 years ago

Sorry, no news on this yet. The usual contributors are busy with other priorities. If anyone's interested in trying, feel free to post questions here.

papoola commented 10 years ago

@heff any news on this? Can you help me in right way, maybe I could contribute

heff commented 10 years ago

If you have time to attempt this that would be great! I don't have the Flash knowledge to tell you the right way to go about it, but if you search for flash pseudo streaming you may find some example implementations.

heff commented 10 years ago

@papoola, you might check out the notes on #83.

papoola commented 10 years ago

@heff thanks this is a big help from @ange007 already. I will take a look later on, see if its easy to do.

ange007 commented 10 years ago

Hello, there are no news?

papoola commented 10 years ago

@ange007 I played a bit with the code today, and this is so far as I have come https://github.com/papoola/video-js-swf/commit/959c63eca7702c76c1b59df74bb3b4960197f6a8

I can't test the code and I think there are more changes needed. Practically I need you or / and some other people to help testing and finding errors. There is a new param introduced which you can pass to to new SWF file : pseudoStreamStartParam. If you set this param then it should load new url. Again this is very beta and we need lot of testing and fixing before I can do a PR

ange007 commented 10 years ago

@papoola, I took the changed *.swf file, and checked so:

vjs.Flash.prototype.play = function(){
    this.el_.vjs_setProperty('pseudoStreamStartParam', 'start');
    this.el_.vjs_play();
};

But it didn't work, there are no requests when rewinding.

papoola commented 10 years ago

@ange007 is it possible for you to set a test video on a remote server with ?start=.. support so I can test this. Or if you know a simple node module for psuedo stream server I could try to implement this in code for testing.

doublex commented 10 years ago

Like this? http://108.59.11.202/sleep-crying-baby.mov?start=30 Thanks

ange007 commented 10 years ago

Excuse - my error, it is necessary to write so:

        // Merge default flashvars with ones passed in to init
        flashVars = vjs.obj.merge({

          // SWF Callback Functions
          'readyFunction': 'videojs.Flash.onReady',
          'eventProxyFunction': 'videojs.Flash.onEvent',
          'errorEventProxyFunction': 'videojs.Flash.onError',

          // Player Settings
          'autoplay': playerOptions.autoplay,
          'preload': playerOptions.preload,
          'loop': playerOptions.loop,
          'muted': playerOptions.muted,

          //@todo: PseudoStreaming check
          'pseudoStreamStartParam': 'start'

        }, options['flashVars']),

or

    //@todo: PseudoStreaming check
    if( options.pseudoStreamStartParam )
    {
        flashVars['pseudoStreamStartParam'] = options.pseudoStreamStartParam;
    }

So parameter is transferred, but the number in an incorrect format is visible, or still something - video starts playing with the beginning.

*.flv?start=1065.8673913043476
ange007 commented 10 years ago

Having taken as a basis @papoola development already some things to mind, but there is a nuance: For MP4, the start ( ?start=* ) parameter needs to be transferred in seconds, and for FLV in milliseconds. I don't know what to invent.

heff commented 10 years ago

@papoola, the work you're doing looks good. Can we get a pull request on the main repo?

@ange007 we could pass the source.type value through to Flash. https://github.com/videojs/video.js/blob/v4.5.2/src/js/media/flash.js#L70

papoola commented 10 years ago

@ange007 so I just need to fix this *.flv?start=1065.8673913043476 to *.flv?start=1065 and maybe introduce a new param for switching between seconds / milliseconds ?

@heff i think if we fix these issues I could do a PR

@doublex thanks ! I will use this for testing

ange007 commented 10 years ago

@papoola, now I will lay out the corrected version. Whether also we will look correctly I made, and that it is necessary to complete (at present I test everything).

ange007 commented 10 years ago

@papoola, look at it: https://github.com/ange007/video-js-swf/commit/b3b7f1e65a3f5aef666d42eaf22863233e08e9a4 @heff, I will look, thanks. But how to be if source.type it isn't specified? I for example don't use it at player creation.

papoola commented 10 years ago

@ange007 wow looks like you have been working alot :) I am reviewing changes, trying to understand the code - particularly looking at role of startOffset

ange007 commented 10 years ago

Join discussions commits: https://github.com/ange007/video-js-swf/commit/b3b7f1e65a3f5aef666d42eaf22863233e08e9a4 https://github.com/ange007/video-js-swf/commit/53015c83fa657417c3770e53cd81d2d26aad2c39# https://github.com/ange007/video-js-swf/commit/e572cb5367475a920b098f5ba50e5dd00afbffef

ange007 commented 10 years ago

I filled in one more commit: https://github.com/ange007/video-js-swf/commit/e572cb5367475a920b098f5ba50e5dd00afbffef

Current visible problems:

P.S. It is probably necessary to clean the buffer somehow?

papoola commented 10 years ago

@ange007 can you tell me about current status of psuedo streaming? I feel like you have gone very deep into code and unfortunately I haven't found any time to help you. Do you feel positive you can do it or are you really stuck somewhere. We really need to have a good testing (manual or automatic) functions for this, did you make that during your work?

ange007 commented 10 years ago

@papoola, unfortunately I didn't have enough time to complete this functionality. And now I am very occupied on work.

I tested manually directly on the working draft. Last version: https://github.com/ange007/video-js-swf/tree/feature/pseudo-streaming

papoola commented 10 years ago

@ange007 I understand and so am I, thank you for your efforts so far. Maybe if you just put a short description (which functions or line numbers) what still has to be done me or other people could collaborate.

ange007 commented 9 years ago

My version is quite efficient. It is possible to test here: http://jsdo.it/ange305/5IHE/fullscreen Problem only is merge of my changes to the old version, everything doesn't want to do manually.

mwisnicki commented 9 years ago

Is it possible to do it with standard HTTP range requests (i.e. same as browsers with video tag) ?

casperbiering commented 9 years ago

@mwisnicki : To my understanding, the Flash Player doesn't support byte range requests.

foxx commented 9 years ago

Given the situation with Flash, personally I'd say this isn't required anymore. Modern browsers are more than capable of playing videos, and supporting this ancient flash technology only prolongs inevitable deprecation of this dead-in-the-water technology.

zofrex commented 9 years ago

If that's the case then remove the flash fallback entirely. While the flash fallback exists, I think it makes sense to keep its features as close to parity with the JS player as possible.

FWIW I think there's still a need for the Flash fallback, as not all browser + O/S combinations support all video formats yet.

foxx commented 9 years ago

@zofrex The sooner Flash dies, the better, and it's the same principle as those who argue that IE8/9 should be supported. If everyone kills support for these products, people will upgrade a lot quicker and the world will be a better place. In fact just one hour ago, we have 15 new vulns for Flash... And these are just the ones we know about.

dominic-p commented 9 years ago

@foxx, that's a valid point, but I think you also have to consider why people want to use a library like Video.js. If we only cared about modern browsers, we could save ~80K and just use native HTML5 for a lot of applications. The last time I checked, IE8 still has significant market share, so a lot of people can't afford to leave those users out. Just my 2 cents. :)

foxx commented 9 years ago

@dominic-p Agreed, and you've hit the nail on the head, the catch 22 of market share. They continue to hold market share because we allow them to, and getting all corporations to drop IE8 support would be like herding cats. The moment one company drops support for it, another will step up and use their legacy support as a marketing advantage lol. Plenty of people out there will to sacrifice developer sanity for the sake of profits and market share. I'm almost certainly off-topic now, but more than happy to continue this convo on Reddit :)

omni1000 commented 9 years ago

It's quite sad that almost 2 years later now this has not been implemented yet. We have nearly 8% of our users who still can not view HTML5 video properly, so we are forced to use flash. But then we put ourselves in a position where we have to explain why "others" can have the seeking feature and we can not.

dave-hansen commented 9 years ago

@omni1000

This stuff isn't easy. Flash wasn't built with this in mind. Everyone here happens to be a volunteer and is working hard to build out this feature on their own time. If you rely upon video-js-swf for your business already, these folks deserve your gratitude and respect for their very hard work.

Can you offer any suggestions to give back and contribute to the development? Do you have any time to volunteer for reviewing code or testing? I'd contact you with some ideas, but it looks like your account was just created today.

On Feb 27, 2015 7:02 AM, "omni1000" notifications@github.com wrote:

It's quite sad that almost 2 years later now this has not been implemented yet. We have nearly 8% of our users who still can not view HTML5 video properly, so we are forced to use flash. But then we put ourselves in a position where we have to explain why "others" can have the seeking feature and we can not.

— Reply to this email directly or view it on GitHub https://github.com/videojs/video-js-swf/issues/13#issuecomment-76407565.

foxx commented 9 years ago

Personally I'd say force people to upgrade their browsers, Flash will be dead in a few years anyway.

papoola commented 9 years ago

Yeah only reason we needed this feature was to support preview files of our media in all browsers, and we had chosen mp4.

Only browser which needed flash fallback in order to play mp4 was FF until recently they also decided to support mp4.

So we are now happy that playback and partial requests work out of the box with mp4 and almost any browser without use of Flash :-)

omni1000 commented 9 years ago

@dave-hansen You are absolutely correct, unfortunately I can not volunteer any time to the project. My respect for everyone involved is big and I am thankful for all the progress being done.

While my "tone" may have left the wrong impression, my comment was more directed towards the fact that being such a successful project, one would expect VideoJS to be able to handle seeking with flash. Not because it is easy, but because the project has become very important and has grown big, and as such it is now being used in production by many, including the service that I work for. But please do not mistake this with an attitude that could be perceived as impudent.

@foxx We've started forcing users to upgrade/change their browsers since i wrote my comment the other day and todays stats show ~4% error rate compared to almost 8% when i wrote the comment. So yes, this will have to do the job, at least for those who know what an upgrade is (and are not still on Win XP)

@papoola I think that even in it's latest iteration, FF on Mac plays mp4 with a flash fallback.

mmcc commented 9 years ago

Regarding Firefox, I'm fairly certain as of FF 36 this isn't the case (but I could be wrong). I use FF Developer Edition, and I'm positive that mp4 playback is native at this moment.

gkatsev commented 9 years ago

Firefox should have it in FF36 across all OSes now.

papoola commented 9 years ago

@omni1000 I do have latest FF on my mac and it does play mp4 natively and partial requests work too.

githubzhaoqian commented 9 years ago

This function has been support? @papoola @ange007 @heff I joined

But there is no response…… Should be how to set up??

<video id="video" class="video-js vjs-default-skin" height="300" max-height="30%" width="600" max-width="30%" controls preload="auto" data-setup='{"techOrder": ["flash", "html5", "other supported tech"]}'

<source src="http://www.sptv-1.com/d/file/jingcailanmu/nongguangtiandi/fdcm1h30m.mp4" type='video/mp4' />

<!--<source src="rtmp://www.sptv-1.com:1935/live/sptv1" type="rtmp/flv">     
<source
   src="http://solutions.brightcove.com/jwhisenant/hls/apple/bipbop/bipbopall.m3u8"
   type="application/x-mpegURL">-->

ange007 commented 9 years ago

@githubzhaoqian, This functionality isn't accepted yet by developers: https://github.com/videojs/video-js-swf/pull/135

ysksuzuki commented 9 years ago

Any update with PR #135 ? I would really appreciate if the function is supported. I think it would be getting more difficult to merge it after adding other commits. It worries me.

yangshenys commented 9 years ago

Since the demo has been finished already about 5 months here #1742, is it in the plan to include this function in the next version? I'm eager to use this to improve the flv file playback experience.

hubertperron commented 9 years ago

Any news on this issue? I'm now considering switching to JWPlayer because of this limitation...

foxx commented 9 years ago

Honestly, just switch over. Flash will be dead in a few years time, if not sooner. Anyone still using Flash to play videos needs to upgrade their system, period.

Recommend that this issue is closed/rejected for the sake of humanity.

ange007 commented 9 years ago

@foxx You of course forgive me, but the matter is actual for many. It is important as for business, and is frequent for a large number of users.