videojs / video-js-swf

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

On demand RTMP needs to specify file extension on NetStream.play() #212

Closed alvaromlg closed 7 years ago

alvaromlg commented 8 years ago

In the NetStream documentation http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#play() it says the extension must be provided for on demands.

In my tests, some CDNs like Edgecast are not working if the extension is not specified like this ns.play("mp4:samples/record1.f4v");

I fixed this, would you guys be interested in a pull request for this? Now is playing rtmp on demands served from Edgecast CDN

It would be something like this:


+        public function getExtension($url:String):String
+        {
+            var extension:String = $url.substring($url.lastIndexOf(".")+1, $url.length);
+            return extension;
+        }

-          _ns.play(_src.streamURL);
+          // Filename extension must be specified for some CDNs like Edgecast
+          _ns.play(getExtension(_src.streamURL) + ":" + _src.streamURL);
mister-ben commented 8 years ago

The convention is to include the prefix within the RTMP URL, e.g.

rtmp://cp67126.edgefcs.net/ondemand/&mp4:mediapm/ovp/content/test/video/spacealonehd_sounas_640_300.mp4

Your change would break that by duplicating the prefix. Also it's not the case that the prefix should always be the same as the file extension, as with your example of mp4:samples/record1.f4v.

alvaromlg commented 8 years ago

Yes, that's a fix to show a use case, that code would also break .mov and .m4v that's why I am asking if you are interested on a pull request.

It should be: mp4, f4v, m4v, mp4 -> mp4: aac, m4a, f4a -> aac: flv -> flv: mp3 -> mp3:

In my experience working with CDNs (Edgecast, Wowza, Akamai) I have never seen the prefix and I have seen other popular flash players implementing some kind of switch to parse the prefix and provide it to the play() method.

Anyway it can be closed if you guys are not experiencing this issue, it might be a CDN configuration issue. Also the parsing could be done outside flash in the server.

gkatsev commented 7 years ago

I think that this change would risk breaking too much stuff. It could potentially be alleviated by making it an option that defaults to false but I would prefer not to add options as well.

Unless there's a lot of demand for this, I think we'd want to pass.