Skip to content
This repository has been archived by the owner on Sep 30, 2021. It is now read-only.

rtmp stream location guess too clever #9

Closed
phloxic opened this issue Oct 1, 2012 · 37 comments
Closed

rtmp stream location guess too clever #9

phloxic opened this issue Oct 1, 2012 · 37 comments
Assignees
Milestone

Comments

@phloxic
Copy link
Contributor

phloxic commented Oct 1, 2012

As far as I can see the rtmp fallback assumes an mp4 file with an identical filename in an identical filesystem (bucket) layout as the http url. There is no way to specify an rtmp filename.

This will fail in a lot of circumstances for a lot of reasons. For instance:

An option to configure the actual rtmp stream location is needed for the cases where the deriving logic is not applicable.

@tipiirai
Copy link
Contributor

tipiirai commented Oct 3, 2012

So now you can configure for example:

rtmp: 'rtmp://s3b78u0kbtx79q.cloudfront.net/cfx/st'

that's the location of RTMP server. Then there is the file name which is given with src attribute an prefixed with "mp4:". How should I change the logic?

Thanks

@phloxic
Copy link
Contributor Author

phloxic commented Oct 3, 2012

Allow full rtmp addresses in a new config option. Like data-rtmpurl="rtmp://stream.blacktrash.org/cfxt/st/mp4:ccc which overrides data-rtmp. Similarly how giving a full rtmp address in clip.url in fp3 overrides the rtmp plugin's netConnectionUrl. - I also might want to play a flv file in rtmp mode, the syntax varies among rtmp servers, CDNs etc. etc.

@tipiirai
Copy link
Contributor

tipiirai commented Oct 3, 2012

How do I know which part of the URL is the netConnectionUrl and which part is the file ?

@tipiirai
Copy link
Contributor

tipiirai commented Oct 3, 2012

Impossible to know netConnectionUrl from this for example:

rtmp://stream.blacktrash.org/cfxt/st/bauhaus/foo.flv

The goal is to make it easy to configure both HTML5 and RTMP urls.

@phloxic
Copy link
Contributor Author

phloxic commented Oct 3, 2012

Perhaps ask the AS3 cracks how they handle this in fp3? Otherwise you can't use rtmp in many real world scenarios.

@phloxic
Copy link
Contributor Author

phloxic commented Oct 3, 2012

Related: http://flowplayer.org/forum/#!/moot/594 - although I hope to solve this for fp3, see:flowplayer/flash#21 - I simply just did not have the time for it.

But yes, I think there should also be an option to configure an independent clip url for flash - automatisms are nice, but getting caught in them is not.

@tipiirai
Copy link
Contributor

tipiirai commented Oct 4, 2012

I think this would be rather nice way to configure it:

<source type="rtmp/mp4" src="mp4:bauhaus/foo"/>
<source type="rtmp/flv" src="foo.flv"/>

@phloxic
Copy link
Contributor Author

phloxic commented Oct 4, 2012

As I want to avoid additional options as much as you do, how about this:

  • leave rtmp option as is (corresponding to fp3's netConnectionUrl
  • introduce something like data-flashurl or data-flashsrc or whatever which, when given, overrides the mp4 source, or, analogous to your proposal: source type=flash src="whatever"

This would even take care of e.g. cloudfront signed urls which alternate between http for html5 and rtmp for flash - if I were to introduce html5 for this demo: http://flowplayer.blacktrash.org/cfxsigned.php, the signatures for http and rtmp would differ completely.

We don't need 2 flash urls, imho. You either serve mp4 or flv.

@tipiirai
Copy link
Contributor

tipiirai commented Oct 4, 2012

Those were just possible examples of configuring the flashurl with the <source/> tag. No need for two source tags if you only want to provide mp4 file for example. I also want to avoid additional options and the source tag would do exactly that - no additional options, just use the standard mechanism for providing additional sources for different kind of types.

@mickey
Copy link

mickey commented Oct 4, 2012

+1 on having the option to configure a different url for flash in fp5. It's currently a hassle to handle cloudfront urls.

@tipiirai
Copy link
Contributor

tipiirai commented Oct 4, 2012

Sure Mickey, will do. Just discussing how. I personally prefer to use additional <source/> tag for that.

@ghost ghost assigned tipiirai Oct 9, 2012
@tipiirai
Copy link
Contributor

tipiirai commented Oct 9, 2012

@mickey can you describe your use case so I can provide a good fix here

@mickey
Copy link

mickey commented Oct 9, 2012

We have mp4 videos served with cloudfront.
The html5 engine needs a non encoded url and the flash engine an encoded url. We need both to make the video work on most browsers.

We're currently using this hack to make it work:

HTML:

<div class='flowplayerv2 minimalist audition-player' non_encoded_url='#{url}'>
  <video autoplay src='#{encoded_url}' type="video/mp4" />

JS:

function supports_video() {
  return !!document.createElement('video').canPlayType;
}

function supports_h264_baseline_video() {
  if (!supports_video()) { return false; }
  var v = document.createElement("video");
  return v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"');
}

$(function() {
  var support = supports_h264_baseline_video();
  if (support != "" && support != false) {
    $(".flowplayerv2 video").attr("src", $(".flowplayerv2").attr("non_encoded_url"));
  }

  $(".flowplayerv2").flowplayer({
     swf: '/flash/flowplayer-5.0.0.swf',
     key: "$7777",
     analytics: "5555"
  });
});

I guess flowplayer has his own browser video support detection. So ideally I would transform my code to this:

  $(".flowplayerv2").flowplayer({
     swf: '/flash/flowplayer-5.0.0.swf',
     flashurl: $(".flowplayerv2").attr("encoded_url"),
     key: "$7777",
     analytics: "5555"
  });
});

@phloxic
Copy link
Contributor Author

phloxic commented Oct 9, 2012

@mickey - unfortunately codec support detection does not work reliably, at least according to my experiments e.g. to fail over to baseline profile for small iOS devices.

@tero - one simple example is: For flash I deploy a different file with a different filename than for html5 to profit from the fact that flash allows reliably high encoding profiles for h.264, I therefore get better quality at lower bitrate in flash.

@tipiirai
Copy link
Contributor

tipiirai commented Oct 9, 2012

Thanks @mickey and @blacktrash. So I'll implement following

<video>
   <!-- for html -->
   <source type="video/mp4" src="bauhaus/foo.mp4"/>

   <!-- for flash, overrides html/mp4 -->
   <source type="video/mp4/flash" src="bauhaus/foo-xyz.mp4"/>
</video>

Does that work for you?

@mickey
Copy link

mickey commented Oct 9, 2012

Perfect, makes sense to have it directly here.

@phloxic
Copy link
Contributor Author

phloxic commented Oct 9, 2012

I don't know why you want to specify mp4, why not just video/flash. The flash video might also be in a different bucket or on a different server. It just has to play in Flash. Just take a full url as value.
If data-rtmp is given it's the url minus the netConnection - no format guessing. Sometime prefixes are needed, sometimes not, depending on the server.

@tipiirai
Copy link
Contributor

tipiirai commented Oct 9, 2012

Because I suggested something. Will use video/flash.

@tipiirai
Copy link
Contributor

tipiirai commented Oct 9, 2012

@blacktrash do we need rtmp configuration at all?

@tipiirai
Copy link
Contributor

tipiirai commented Oct 9, 2012

Ignore my last question; we need it so we know which part of the url belongs to Flash netConnection

@tipiirai
Copy link
Contributor

tipiirai commented Oct 9, 2012

Done. Here is a demo:

http://example.flowplayer.org/basics/rtmp.html

flash engine now understands "video/flash" the order of the elements determines which one is used first.

the URL determination is now dummy. no wisdom. just given directly to the play() method

@phloxic
Copy link
Contributor Author

phloxic commented Oct 9, 2012

As long as the probably "illegal" html5 source type does not cause problems: good.

But the "video does not play through" issue is back with rtmp. Stops at 36 or 37 seconds here.

@tipiirai
Copy link
Contributor

tipiirai commented Oct 9, 2012

It has actually been there always but haven't been debugged with RTMP before. Now also fixed from RTMP.

@phloxic
Copy link
Contributor Author

phloxic commented Oct 9, 2012

I know it had always been there, but did not want to get on your nerves ;-)

@tipiirai
Copy link
Contributor

tipiirai commented Oct 9, 2012

heh, thanks... with this speed I think we're getting close to 5.1

@phloxic
Copy link
Contributor Author

phloxic commented Oct 12, 2012

I can't get rtmp to work anymore - with or without video/flash:
http://flowplayer.blacktrash.org/fp5/mp4only.html

@tipiirai
Copy link
Contributor

Your example does not really try to configure rtmp.

Please follow this demo:

http://example.flowplayer.org/basics/rtmp.html

@phloxic
Copy link
Contributor Author

phloxic commented Oct 12, 2012

What's wrong with:

flowplayer.conf = { 
   swf: "http://example.flowplayer.org/flowplayer.swf",
   engine: "flash",
   rtmp: "rtmp://stream.blacktrash.org/cfx/st"
};

???

@phloxic
Copy link
Contributor Author

phloxic commented Oct 12, 2012

btw, I tried with data-* attributes first actually - failed as well.

@phloxic
Copy link
Contributor Author

phloxic commented Oct 12, 2012

AHA - only works with video/flash type as the first source!

@tipiirai
Copy link
Contributor

I was looking at this page: http://flowplayer.blacktrash.org/fp5/mp4only.html

@phloxic
Copy link
Contributor Author

phloxic commented Oct 12, 2012

Yes. It has the mentioned global config.

@phloxic
Copy link
Contributor Author

phloxic commented Oct 12, 2012

Now also the data-* attributes. If video/flash is not specified as first source, it does not work.

@tipiirai
Copy link
Contributor

Updated flowplayer.js. Your page works now.

@phloxic
Copy link
Contributor Author

phloxic commented Oct 13, 2012

Thumbs up!

@CuriousGuy
Copy link

HELLO BLACKTRASH PLEASE HOW CAN I DOWNLOAD THIS EMBEDED VIDEO

@CuriousGuy
Copy link

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants