JWPlayer can't play video
Asked Answered
D

2

5

I am trying to use JWPlayer to play videos on my website.

The video file is given as an url from our server, but the thing is the url does not contains any format, since the file is stored as a blob on server side.

So, does anyone know how to solve it? Thanks.

Here is my code as javascript:

function loadVideoByUrlWithSize(elementId, videoUrl, videoThumbnail, width, height) {
    jwplayer(elementId).setup({
        file : videoUrl,
        image : videoThumbnail,
        width : width,
        height : height
    });
 }
Daiquiri answered 19/7, 2013 at 10:45 Comment(0)
W
7

The JW Player does need to know the extension, but you can also set the type as well in the player setup().

If you are using JW6, under this line:

file : videoUrl,

Add:

type : 'mp4',

For example. If it is a flv, make it flv...

If you are using JW5, under this line:

file : videoUrl,

Add:

provider: 'video',

Hope this helps!

Welcher answered 19/7, 2013 at 15:26 Comment(4)
This seems like an easier solution than mine.Studdingsail
Thanks, Ethan. I tried your solution, but unfortunately, it was still failed, here is the error msg: No suitable players found and fallback enabledDaiquiri
Hm, can I see where you are running this?Welcher
do you have any link ?Sarge
S
2

It sounds as if JWPlayer requires the file extension to know how to play the file.
Try url rewriting (.htaccess, iis) and basically append .mp4 (or whatever the file type) to fix the issue.

Studdingsail answered 19/7, 2013 at 10:58 Comment(1)
Thanks, Evolutionxbox. I can not append file extension to the url directly, it won't work.Daiquiri

© 2022 - 2024 — McMap. All rights reserved.