0

I am trying to get the filename or URL of the currently playing video in Flowplayer and display it in my show div. I thought I could use getClip().completeUrl but I get undefined as the output. If I do something that isn't a string, like getClip().fullDuration (an integer), the output works as expected. Why am I getting undefined?

Here's my javascript:

function getURL(){
var url = flowplayer().getClip().completeUrl;
$("#show").empty();
$('#show').append(url);
}

Here's my HTML:

<input type="button" id="get" value="Get URL" onclick="getURL()" />
<input type="text" id="show" name="show" />

Here's the player javascript:

$f("player", "http://releases.flowplayer.org/swf/flowplayer-3.2.11.swf", {
buffering : false,
clip: {
        provider: 'rtmp',
        baseUrl: 'http://example.com',

        streams: [

        { url: 'flv:video123'},

        ]
    },
    plugins: {
        rtmp: {
                url: "flowplayer.rtmp-3.2.10.swf",
                netConnectionUrl: 'rtmp://example.com/vod'
        }
    }

});

  • Works for me, when using the basic demo code for the Flowplayer instance. `completeUrl` is set as expected. See http://jsfiddle.net/MY5sf/ I modified the output, though, as the value attribute does not make much sense on a `div`. – pixelistik Jul 08 '12 at 11:44
  • `console.log(flowplayer().getClip())` and use Firebug or some other Javascript development tool to view the console output. – pixelistik Jul 08 '12 at 14:10

2 Answers2

2

Here's what the Flowplayer documentation says about completeUrl:

This is the concatenation of the clip's baseUrl property and the clip's url property. baseUrl is undefined if you did not set it explicitly.

If you have not set baseUrl, this could possibly mean that completeUrl cannot be built. But in this case it is identical to url anyway, so you can use that one.

var url = flowplayer().getClip().url;

Update

As the OP found out, apparently there is no completeUrl when using a RTMP stream list. But it works when using RTMP without a stream list.

pixelistik
  • 7,541
  • 3
  • 32
  • 42
0

Try text box or label instead of div tag.because normally div tag don't have value attribute. Then Try

onclick="return getURL();" instead of onclick="getURL()". Have u tried var url = flowplayer().getClip(0).url;

LittleOne
  • 131
  • 1
  • 4
  • 16