2017-12-18 209 views
1

IM开发Android应用程序从服务器的负载不同的媒体类型的视频,音频和PDF格式的URL,媒体来以HTML格式是这样的:负荷的html媒体像机器人

  { 
    "messages_PK_ID": 390, 
    "messages_Name": "المنهج التأسيسي1/ الفصل الثاني عشر/ منعطفات الوعي", 
    "messages_ToSendDateDiff": 330, 
    "message_URL": " <div>\r\n  <table dir=\"rtl\">\r\n   <tbody>\r\n    <tr>\r\n     <td>\r\n      <table id=\"table1\" dir=\"rtl\">\r\n       <tbody>\r\n         <tr>\r\n         <td>\r\n          <p style=\"text-align: center; font-size: x-large; font-weight: bold\">\r\n           <a href=\"http://iacademypd.com/ViewVideos.aspx?id=vihVoSHf%2brFvvGg8GY25%2bQ%3d%3d\">إذا واجهتك مشكلة في فتح المواد ... الرجاء الضغط هنا \r\n           </a>\r\n          </p>\r\n          <p style=\"text-align: center; font-size: x-large; font-weight: bold\">\r\n           &nbsp;</p>\r\n         </td>\r\n        </tr>\r\n        <tr>\r\n         <td style=\"text-align: center;\">\r\n\r\n          <span style=\"font-size: 18px;\">صديقنا المستكشف نقدم لك المادة المصوّرة للفصل الثاني عشر من المنهج التأسيسي1، يشرحه لك د. صلاح الراشد بعنوان</span></td>\r\n        </tr>\r\n        <tr>\r\n         <td style=\"text-align: center; height: 70px; font-size: x-large; font-weight: bold;\"><span style=\"color: #ff0000;\">\"منعطفات الوعي\"</span></td>\r\n        </tr>\r\n        <tr>\r\n         <td style=\"text-align: center; padding-top: 20px;\"><span style=\"font-size: 18px;\">لتحقيق الاستفادة والمتعة القصوى في التعلّم، نقترح عليك أن تتكرّم بالضغط على صورة الكراسة أدناه وطباعة محتواها، ثم استخدامها أثناء الاستماع إلى هذه المادة في مكان هادئ بعيداً عن المقاطعات</span></td>\r\n        </tr>\r\n        <tr>\r\n         <td>\r\n          <p style=\"text-align: center;\">\r\n           <a href=\"http://iacademypd.com/AttachFiles/korrassah-12.pdf\">\r\n            <img alt=\"\" width=\"171\" height=\"136\" style=\"border-color: black;\" src=\"images/notebook.jpg\" /></a>\r\n          </p>\r\n         </td>\r\n        </tr>\r\n        <tr>\r\n         <td style=\"padding-top: 20px;\" align=\"center\">\r\n\r\n          <table style=\"text-align: center;\" dir=\"rtl\">\r\n           <tbody>\r\n            <tr>\r\n             <td>\r\n              <div class=\"easyhtml5video\" style=\"position: relative; max-width: 592px;\">\r\n               <video controls=\"controls\" poster=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/Part1.jpg\" style=\"width: 100%\" title=\"Part12-1\">\r\n                <source src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/Part1.m4v\" type=\"video/mp4\" />\r\n                <source src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/Part1.webm\" type=\"video/webm\" />\r\n                <object type=\"application/x-shockwave-flash\" data=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/flashfox.swf\" width=\"500\" height=\"480\" style=\"position: relative;\">\r\n                 <param name=\"movie\" value=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/flashfox.swf\" />\r\n                 <param name=\"allowFullScreen\" value=\"true\" />\r\n                 <param name=\"flashVars\" value=\"autoplay=False&amp;controls=true&amp;fullScreenEnabled=true&amp;posterOnEnd=true&amp;loop=false&amp;poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/Part1.jpg&amp;src=Part1.m4v\" />\r\n                 <embed src=\"http://iacademypd.com/AttachFiles/Year1/Part12/Part12-1/eh5v.files/html5video/flashfox.swf\" width=\"592\" height=\"480\" style=\"position: relative;\" flashvars=\"autoplay=False&amp;controls=true&amp;fullScreenEnabled=true&amp;posterOnEnd=true&amp;loop=false&amp;poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/Part1.jpg&amp;src=Part1.m4v\" allowfullscreen=\"true\" wmode=\"transparent\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer_en\" />\r\n                 <img alt=\"Part12-1\" src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/Part1.jpg\" style=\"position: absolute; left: 0;\" width=\"100%\" title=\"Video playback is not supported by your browser\" />\r\n                </object>\r\n               </video>\r\n              </div>\r\n              <strong><span style=\"font-size: large; color: #ff0000;\">الجزء الأول</span></strong>\r\n\r\n             </td>\r\n             <td>\r\n              <div class=\"easyhtml5video\" style=\"position: relative; max-width: 592px;\">\r\n               <video controls=\"controls\" poster=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/Part2.jpg\" style=\"width: 100%\" title=\"Part12-2\">\r\n                <source src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/Part2.m4v\" type=\"video/mp4\" />\r\n                <source src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/Part2.webm\" type=\"video/webm\" />\r\n                <object type=\"application/x-shockwave-flash\" data=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/flashfox.swf\" width=\"500\" height=\"480\" style=\"position: relative;\">\r\n                 <param name=\"movie\" value=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/flashfox.swf\" />\r\n                 <param name=\"allowFullScreen\" value=\"true\" />\r\n                 <param name=\"flashVars\" value=\"autoplay=False&amp;controls=true&amp;fullScreenEnabled=true&amp;posterOnEnd=true&amp;loop=false&amp;poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/Part2.jpg&amp;src=Part2.m4v\" />\r\n                 <embed src=\"http://iacademypd.com/AttachFiles/Year1/Part12/Part12-2/eh5v.files/html5video/flashfox.swf\" width=\"592\" height=\"480\" style=\"position: relative;\" flashvars=\"autoplay=False&amp;controls=true&amp;fullScreenEnabled=true&amp;posterOnEnd=true&amp;loop=false&amp;poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/Part2.jpg&amp;src=Part2.m4v\" allowfullscreen=\"true\" wmode=\"transparent\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer_en\" />\r\n                 <img alt=\"Part12-2\" src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/Part2.jpg\" style=\"position: absolute; left: 0;\" width=\"100%\" title=\"Video playback is not supported by your browser\" />\r\n                </object>\r\n               </video>\r\n              </div>\r\n\r\n\r\n              <strong><span style=\"font-size: large; color: #ff0000;\">الجزء الثاني</span></strong></td>\r\n             <td>\r\n              <div class=\"easyhtml5video\" style=\"position: relative; max-width: 592px;\">\r\n               <video controls=\"controls\" poster=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/Part3.jpg\" style=\"width: 100%\" title=\"Part12-3\">\r\n                <source src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/Part3.m4v\" type=\"video/mp4\" />\r\n                <source src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/Part3.webm\" type=\"video/webm\" />\r\n                <object type=\"application/x-shockwave-flash\" data=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/flashfox.swf\" width=\"500\" height=\"480\" style=\"position: relative;\">\r\n                 <param name=\"movie\" value=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/flashfox.swf\" />\r\n                 <param name=\"allowFullScreen\" value=\"true\" />\r\n                 <param name=\"flashVars\" value=\"autoplay=False&amp;controls=true&amp;fullScreenEnabled=true&amp;posterOnEnd=true&amp;loop=false&amp;poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/Part3.jpg&amp;src=Part3.m4v\" />\r\n                 <embed src=\"http://iacademypd.com/AttachFiles/Year1/Part12/Part12-3/eh5v.files/html5video/flashfox.swf\" width=\"592\" height=\"480\" style=\"position: relative;\" flashvars=\"autoplay=False&amp;controls=False&amp;fullScreenEnabled=true&amp;posterOnEnd=true&amp;loop=false&amp;poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/Part3.jpg&amp;src=Part3.m4v\" allowfullscreen=\"true\" wmode=\"transparent\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer_en\" />\r\n                 <img alt=\"Part12-3\" src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/Part3.jpg\" style=\"position: absolute; left: 0;\" width=\"100%\" title=\"Video playback is not supported by your browser\" />\r\n                </object>\r\n               </video>\r\n              </div>\r\n              <strong><span style=\"font-size: large; color: #ff0000;\">الجزء الثالث</span></strong></td>\r\n             <td>\r\n              <div class=\"easyhtml5video\" style=\"position: relative; max-width: 592px;\">\r\n               <video controls=\"controls\" poster=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/Part4.jpg\" style=\"width: 100%\" title=\"Part12-4\">\r\n                <source src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/Part4.m4v\" type=\"video/mp4\" />\r\n                <source src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/Part4.webm\" type=\"video/webm\" />\r\n                <object type=\"application/x-shockwave-flash\" data=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/flashfox.swf\" width=\"500\" height=\"480\" style=\"position: relative;\">\r\n                 <param name=\"movie\" value=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/flashfox.swf\" />\r\n                 <param name=\"allowFullScreen\" value=\"true\" />\r\n                 <param name=\"flashVars\" value=\"autoplay=False&amp;controls=true&amp;fullScreenEnabled=true&amp;posterOnEnd=true&amp;loop=false&amp;poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/Part4.jpg&amp;src=Part4.m4v\" />\r\n                 <embed src=\"http://iacademypd.com/AttachFiles/Year1/Part12/Part12-4/eh5v.files/html5video/flashfox.swf\" width=\"592\" height=\"480\" style=\"position: relative;\" flashvars=\"autoplay=False&amp;controls=False&amp;fullScreenEnabled=true&amp;posterOnEnd=true&amp;loop=false&amp;poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/Part4.jpg&amp;src=Part4.m4v\" allowfullscreen=\"true\" wmode=\"transparent\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer_en\" />\r\n                 <img alt=\"Part12-4\" src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/Part4.jpg\" style=\"position: absolute; left: 0;\" width=\"100%\" title=\"Video playback is not supported by your browser\" />\r\n                </object>\r\n               </video>\r\n              </div>\r\n              <strong><span style=\"font-size: large; color: #ff0000;\">الجزء الرابع</span></strong></td>\r\n             \r\n\r\n            </tr>\r\n           </tbody>\r\n          </table>\r\n\r\n         </td>\r\n        </tr>\r\n        <tr>\r\n         <td>\r\n          <p style=\"text-align: center; font-size: x-large; font-weight: bold\">\r\n           <a href=\"http://iacademypd.com/ViewVideos.aspx?id=vihVoSHf%2brFvvGg8GY25%2bQ%3d%3d\">إذا واجهتك مشكلة في فتح المواد ... الرجاء الضغط هنا \r\n           </a>\r\n\r\n          </p>\r\n         </td>\r\n        </tr>\r\n       </tbody>\r\n      </table>\r\n     </td>\r\n    </tr>\r\n\r\n   </tbody>\r\n  </table>\r\n  <div class=\"eh5v_script\"></div>\r\n  <script src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part1/Part1-3/eh5v.files/html5video/html5ext.js\" type=\"text/javascript\"></script>\r\n </div>", 

我已经存储的URL在一个字符串,但我如何能在Android的开放web视图,请注意这个网站可能包含视频或音频,甚至PDF

在此先感谢

+0

**'webView.loadData(StringData,“text/html”,“UTF-8”);'** –

+0

谢谢亲爱的它的工作,但如果我有图像也喜欢这个http://iacademypd.com/AttachFiles/card-364aaa.jpg \“ –

回答

1

使用webView.loadData()

使用“数据”方案URL将给定数据加载到此WebView中。

webView.loadData(htmlStringData, "text/html", "UTF-8"); 

编辑

加载简单的URL中使用

webView.loadUrl(url); 

CODE

if(isURL) // check here that `URL` or `HTML` 
{ 
    webView.loadUrl(url); 
}else{ 
    webView.loadData(htmlStringData, "text/html", "UTF-8"); 
} 

加载都需要检查天气你的URL包含html标记或不

+0

https://stackoverflow.com/users/7666442/nilu如果想要我有包含html和http链接的列表,并且我想要webview打开任何选定的一个http://iacademypd.com/AttachFiles/card-364aaa.jpg –

+0

@ahmedjallad没有得到你我的朋友 –

+0

我有一个列表,其中包含不同的网址链接,有些是HTML格式和其他媒体( http:/myfile/images/hi.png),如何让相同的webview打开其中的任何一个,如果他们点击 –