javascript - JW Player can not play m3u8 stream? - Stack Overflow

with check this example, .html , I tried the example myself, There is my code:<html><head>

with check this example, .html , I tried the example myself, There is my code:

<html>
<head>

    <script type="text/javascript" src="jwplayer.js"></script>
    <script src=".4.2/jquery.min.js"></script>
    <title>Provider tests</title>
    <style>
        body { padding: 50px; font: 13px/20px Arial; background: #EEE; }
        form { margin-top: 20px; }
        #player { -webkit-box-shadow: 0 0 5px #999; background: #000; }
        ul { margin-top: 40px; padding: 0 0 0 20px; list-style-type: square; }
    </style>

</head>
<body>

    Test M3U8
    <div id="player">You need Flash to play these tests</div>

    <script type="text/javascript">
        jwplayer("player").setup({
            file: '../m3u8/index.m3u8',
            flashplayer: 'player.swf',
            provider:'adaptiveProvider.swf',
            height: 360,
            width: 640
        });
        function loadStream(url) {
            jwplayer("player").load({file: url,provider: 'adaptiveProvider.swf'});
            jwplayer("player").play();
            return false;
        }

        $(document).ready(function() {
            loadStream('http://localhost/m3u8/index.m3u8');
        });
    </script>
    <ul id="streamlist"></ul>
    <div id="panel"></div>
</body>
</html> 

But the Jw Play can not work

BTW: my vlc can play http://localhost/m3u8/index.m3u8 well

with check this example, http://developer.longtailvideo./player/branches/adaptive/test/provider.html , I tried the example myself, There is my code:

<html>
<head>

    <script type="text/javascript" src="jwplayer.js"></script>
    <script src="http://ajax.googleapis./ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <title>Provider tests</title>
    <style>
        body { padding: 50px; font: 13px/20px Arial; background: #EEE; }
        form { margin-top: 20px; }
        #player { -webkit-box-shadow: 0 0 5px #999; background: #000; }
        ul { margin-top: 40px; padding: 0 0 0 20px; list-style-type: square; }
    </style>

</head>
<body>

    Test M3U8
    <div id="player">You need Flash to play these tests</div>

    <script type="text/javascript">
        jwplayer("player").setup({
            file: '../m3u8/index.m3u8',
            flashplayer: 'player.swf',
            provider:'adaptiveProvider.swf',
            height: 360,
            width: 640
        });
        function loadStream(url) {
            jwplayer("player").load({file: url,provider: 'adaptiveProvider.swf'});
            jwplayer("player").play();
            return false;
        }

        $(document).ready(function() {
            loadStream('http://localhost/m3u8/index.m3u8');
        });
    </script>
    <ul id="streamlist"></ul>
    <div id="panel"></div>
</body>
</html> 

But the Jw Play can not work

BTW: my vlc can play http://localhost/m3u8/index.m3u8 well

Share Improve this question asked May 24, 2012 at 8:58 whywhy 24.9k30 gold badges98 silver badges146 bronze badges 1
  • This has been asked since but apparently it also got no quality answers: stackoverflow./questions/14988021/… – chiliNUT Commented May 2, 2020 at 7:05
Add a ment  | 

2 Answers 2

Reset to default 1

It seems you need to buy premium jwplayer license in order to play m3u8 streams. You can read about it in their site

http://www.jwplayer./pricing/

It says Apple HLS Streams under the third box, which is what m3u8 really is.

Perhaps it's a missing !DOCTYPE declaration that you don't have.

I don't have ability to test this personally, but try this version that also includes other fixes based on the original file.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3/1999/xhtml" lang="en" xml:lang="en">
  <head>
    <title>Provider tests</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <script type="text/javascript" src="http://ajax.googleapis./ajax/libs/jquery/1.4.2/jquery.min.js">

    </script>
        <script type="text/javascript" src="jwplayer.js">
    </script>

<style type="text/css">
/*<![CDATA[*/
        body { padding: 50px; font: 13px/20px Arial; background: #EEE; }
        form { margin-top: 20px; }
        #player { -webkit-box-shadow: 0 0 5px #999; background: #000; }
        ul { margin-top: 40px; padding: 0 0 0 20px; list-style-type: square; }
/*]]>*/
</style>

</head>
<body>

Test M3U8

<div id="player">You need Flash to play these tests</div>

<script type="text/javascript">
//<![CDATA[
        jwplayer("player").setup({
            file: '../m3u8/index.m3u8',
            flashplayer: 'player.swf',
            provider:'adaptiveProvider.swf',
            height: 360,
            width: 640
        });
        function loadStream(url) {
            jwplayer("player").load({file: url,provider: 'adaptiveProvider.swf'});
            jwplayer("player").play();
            return false;
        }

//]]>
</script>

<ul id="streamlist"></ul>
<div id="panel"></div>

<script type="text/javascript">
//<![CDATA[
        $(document).ready(function() {
            loadStream('http://localhost/m3u8/index.m3u8');
        });
//]]>
</script>

</body>
</html>

EDIT: Note that you will have to be on the same Domain for this to work. Also, jwPlayer forum mentions that .m3u8 works only for iOS and Safari. Reference HERE.

To test a valid .m3u8 streaming playback webpage provided by LongTail Video website with your device, access this WEBPAGE. Caution when using desktop browser! It or VLC Media Player Plugin might crash with a sad face.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745616883a4636288.html

相关推荐

  • javascript - JW Player can not play m3u8 stream? - Stack Overflow

    with check this example, .html , I tried the example myself, There is my code:<html><head>

    6小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信