简体   繁体   中英

JWPlayer in Webview doesn't work Android Studio

I don't know why my iframe doesn't want to work, I use html with external file in asset folder. The iFrame appears, but it's written : Error loading player: No playable sources found .

Here is my code :

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

WebView wv = (WebView) findViewById(R.id.webcamView);
WebSettings webSettings = wv.getSettings();
webSettings.setBuiltInZoomControls(true);
wv.getSettings().setJavaScriptEnabled(true);

wv.loadUrl("file:///android_asset/test.html");
}

Here is my HTML :

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html><head>
    <title>Bundoran Surf Co</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

        <script async="" src="//www.google-analytics.com/analytics.js"></script><script>
            (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
             (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
             m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
             })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

             ga('create', 'UA-40971454-1', 'myipstream.com');
             ga('send', 'pageview');

            </script><script src="http://jwpsrv.com/library/bkfmKFnaEeKE5iIACp8kUw.js"></script><style type="text/css"></style><script src="http://p.jwpcdn.com/6/11/jwpsrv.js"></script><script src="http://p.jwpcdn.com/6/11/sharing.js"></script><script src="http://p.jwpcdn.com/6/jwpsrv_frq.js"></script><style type="text/css"></style></head>

<body>
    <div id="banner"></div>

    <div id="my-video"></div>


    <div align="center" id="playerKQLqhEDY5doy_wrapper" style="position: relative; display: block; width: 1000px; height: 600px; overflow:auto;-webkit-overflow-scrolling:touch"><a id="beforeswfanchor0" href="#playerKQLqhEDY5doy" tabindex="0" title="Flash start" style="border:0;clip:rect(0 0 0 0);display:block;height:1px;margin:-1px;outline:none;overflow:hidden;padding:0;position:absolute;width:1px;" data-related-swf="playerKQLqhEDY5doy"></a><object type="application/x-shockwave-flash" data="http://p.jwpcdn.com/6/11/jwplayer.flash.swf" width="100%" height="100%" bgcolor="#000000" id="playerKQLqhEDY5doy" name="playerKQLqhEDY5doy" class="jwswf swfPrev-beforeswfanchor0 swfNext-afterswfanchor0" tabindex="0"><param name="allowfullscreen" value="true"><param name="allowscriptaccess" value="always"><param name="seamlesstabbing" value="true"><param name="wmode" value="opaque"></object><a id="afterswfanchor0" href="#playerKQLqhEDY5doy" tabindex="0" title="Flash end" style="border:0;clip:rect(0 0 0 0);display:block;height:1px;margin:-1px;outline:none;overflow:hidden;padding:0;position:absolute;width:1px;" data-related-swf="playerKQLqhEDY5doy"></a><div id="playerKQLqhEDY5doy_aspect" style="display: none;"></div><div id="playerKQLqhEDY5doy_jwpsrv" style="position: absolute; top: 0px; z-index: 10;"></div><div id="playerKQLqhEDY5doy_sharing" style="position: absolute; top: 0px; z-index: 11;"></div></div>
    <script type="text/javascript">
        jwplayer('playerKQLqhEDY5doy').setup({
                                             playlist: [{
                                                        image: "http://www.bundoransurfco.com/wp-content/uploads/2010/12/homepage_offers1.jpg",
                                                        sources: [{
                                                                  file: "http://144.76.75.86/hls/bundoransurfco/playlist.m3u8"
                                                                  }]
                                                        }],
                                             height: 200,
                                             primary: "flash",
                                             width: 315,
                                             controls: true,
                                             autostart: true,
                                             androidhls: true,
                                             sharing: true

                                             });
        </script>

    <style type="text/css">
        #playerKQLqhEDY5doy_wrapper {
            left:0em;
            right:0em;
            top:12.2em;
            bottom:-5em;
            max-width: 100%;
            max-height: 100%;

        }
    #photo{
        position:fixed;
        max-width: 100%;
        top:50px;
        left : 0em;
        right:0em;
        display:block;
    }
    iframe, object, embed {

        position:relative;
    }
    </style>
    <span id="photo" align="middle">
            <img src="http://myipstream.com/images/bundoran.jpeg" width="139" height="50" alt="@ Surf Co">



</body></html>

Here is my Logcat (updated):

04-27 10:42:55.814  11616-11616/jardelcompany.test V/WebViewChromiumFactoryProvider﹕ Binding Chromium to main looper Looper (main, tid 1) {528248fc}
04-27 10:42:55.814  11616-11616/jardelcompany.test I/LibraryLoader﹕ Expected native library version number "",actual native library version number ""
04-27 10:42:55.814  11616-11616/jardelcompany.test I/chromium﹕ [INFO:library_loader_hooks.cc(116)] Chromium logging enabled: level = 0, default verbosity = 0
04-27 10:42:55.818  11616-11616/jardelcompany.test I/BrowserStartupController﹕ Initializing chromium process, renderers=0
04-27 10:42:55.834  11616-11616/jardelcompany.test E/AudioManagerAndroid﹕ BLUETOOTH permission is missing!
04-27 10:42:55.854  11616-11616/jardelcompany.test D/libEGL﹕ loaded /system/lib/egl/libEGL_genymotion.so
04-27 10:42:55.858  11616-11616/jardelcompany.test D/﹕ HostConnection::get() New Host Connection established 0xb8f59b48, tid 11616
04-27 10:42:55.874  11616-11616/jardelcompany.test D/libEGL﹕ loaded /system/lib/egl/libGLESv1_CM_genymotion.so
04-27 10:42:55.874  11616-11616/jardelcompany.test D/libEGL﹕ loaded /system/lib/egl/libGLESv2_genymotion.so
04-27 10:42:55.918  11616-11616/jardelcompany.test W/chromium﹕ [WARNING:mailbox_synchronizer.cc(36)] MailboxSync not supported due to missing EGL image/fence support
04-27 10:42:55.942  11616-11616/jardelcompany.test D/dalvikvm﹕ GC_FOR_ALLOC freed 148K, 6% free 3710K/3928K, paused 3ms, total 3ms
04-27 10:42:55.946  11616-11616/jardelcompany.test D/dalvikvm﹕ GC_FOR_ALLOC freed 4K, 6% free 3927K/4152K, paused 3ms, total 3ms
04-27 10:42:55.950  11616-11616/jardelcompany.test I/dalvikvm-heap﹕ Grow heap (frag case) to 6.320MB for 2536932-byte allocation
04-27 10:42:55.954  11616-11626/jardelcompany.test D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 4% free 6405K/6632K, paused 3ms, total 3ms
04-27 10:42:56.010  11616-11640/jardelcompany.test W/chromium﹕ [WARNING:proxy_service.cc(890)] PAC support disabled because there is no system implementation
04-27 10:42:56.294  11616-11616/jardelcompany.test W/EGL_genymotion﹕ eglSurfaceAttrib not implemented
04-27 10:42:56.298  11616-11616/jardelcompany.test E/OpenGLRenderer﹕ Getting MAX_TEXTURE_SIZE from GradienCache
04-27 10:42:56.298  11616-11616/jardelcompany.test E/OpenGLRenderer﹕ MAX_TEXTURE_SIZE: 16384
04-27 10:42:56.314  11616-11616/jardelcompany.test E/OpenGLRenderer﹕ Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
04-27 10:42:56.322  11616-11616/jardelcompany.test E/OpenGLRenderer﹕ MAX_TEXTURE_SIZE: 16384
04-27 10:42:56.322  11616-11616/jardelcompany.test D/OpenGLRenderer﹕ Enabling debug mode 0
04-27 10:42:56.334  11616-11616/jardelcompany.test W/AwContents﹕ nativeOnDraw failed; clearing to background color.
04-27 10:42:56.538  11616-11616/jardelcompany.test W/AwContents﹕ nativeOnDraw failed; clearing to background color.
04-27 10:42:56.830  11616-11616/jardelcompany.test I/chromium﹕ [INFO:CONSOLE(1)] "Uncaught TypeError: Object #<Object> has no method 'setSampleFrequency'", source: http://p.jwpcdn.com/6/jwpsrv_frq.js (1)
04-27 10:42:56.954  11616-11616/jardelcompany.test I/chromium﹕ [INFO:async_pixel_transfer_manager_android.cc(60)] Async pixel transfers not supported
04-27 10:42:56.978  11616-11616/jardelcompany.test E/chromium﹕ [ERROR:gles2_cmd_decoder_autogen.h(1082)] [GroupMarkerNotSet(crbug.com/242999)!:28450CB9]GL ERROR :GL_INVALID_OPERATION : GetIntegerv: <- error from previous GL command
04-27 10:42:56.998  11616-11616/jardelcompany.test I/chromium﹕ [INFO:async_pixel_transfer_manager_android.cc(60)] Async pixel transfers not supported
04-27 10:42:57.018  11616-11616/jardelcompany.test E/chromium﹕ [ERROR:gles2_cmd_decoder_autogen.h(1082)] [GroupMarkerNotSet(crbug.com/242999)!:C0A812B9]GL ERROR :GL_INVALID_OPERATION : GetIntegerv: <- error from previous GL command
04-27 10:42:57.102  11616-11616/jardelcompany.test D/dalvikvm﹕ GC_FOR_ALLOC freed 89K, 3% free 7193K/7376K, paused 4ms, total 4ms
04-27 10:43:00.362  11616-11616/jardelcompany.test I/chromium﹕ [INFO:async_pixel_transfer_manager_android.cc(60)] Async pixel transfers not supported
04-27 10:43:00.750  11616-11616/jardelcompany.test E/chromium﹕ [ERROR:gles2_cmd_decoder_autogen.h(1082)] [GroupMarkerNotSet(crbug.com/242999)!:10D3F9B8]GL ERROR :GL_INVALID_OPERATION : GetIntegerv: <- error from previous GL command
04-27 10:43:01.518  11616-11616/jardelcompany.test E/chromium﹕ [ERROR:gles2_cmd_decoder_autogen.h(69)] [.Video-Offscreen-main-thread-0xb91cb650]GL ERROR :GL_INVALID_ENUM : glBindTexture: target was GL_TEXTURE_EXTERNAL_OES
04-27 10:43:01.518  11616-11616/jardelcompany.test E/chromium﹕ [ERROR:gles2_cmd_decoder_autogen.h(3123)] [.Video-Offscreen-main-thread-0xb91cb650]GL ERROR :GL_INVALID_ENUM : glProduceTextureCHROMIUM: target was GL_TEXTURE_EXTERNAL_OES

在此处输入图片说明

Don't use RTMP sources. RTMP requires Flash, which Android definitely doesn't support, especially in an App.

So, remove the RTMP source, and just use the HLS one.

Then, under this line:

autostart: true,

Add:

androidhls: true,

I am not sure if that will work in the app though - you may have to use an HTTP delivered MP4 source.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM