gpt4 book ai didi

android - 从android中的url加载html媒体,如视频、音频和pdf

转载 作者:行者123 更新时间:2023-11-30 00:12:54 25 4
gpt4 key购买 nike

我正在开发 android 应用程序,从服务器加载不同的媒体类型,媒体以 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 的 webview 中打开,注意这个 html 可能包含视频或音频甚至 pdf

提前致谢

最佳答案

使用webView.loadData()

Loads the given data into this WebView using a 'data' scheme URL.

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

编辑

加载简单的 URL 使用

webView.loadUrl(url);

代码

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

要同时加载你需要检查你的 URL 是否包含 html 标签

关于android - 从android中的url加载html媒体,如视频、音频和pdf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47862913/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com