dsf4s5787 2012-11-11 13:13
浏览 296

Android WebView嵌入式(flash)视频播放器

Situation

In my application I have a WebView which loads its data inside an IFrame from an url.

Code Snippet:

String url = www.myexampleurl.com/video1.html;
String data = "<IFRAME SRC=" + url + " FRAMEBORDER=0 ... />";
WebView.loadData(data, MIME_TYPE, ENCODING); 

The website itself, loads his video into a flash player and I simply display this in the WebView. This works perfectly, with one nasty sidenote... Android has stopped supporting flash which means in the future my application will not work anymore by default. -Not acceptable!-

What I tried already

Solution to replace the flashplayer

I fetched the url of the video that is given to the flashplayer and I load it directly inside a VideoView or WebView with HTML5. These work solutions work! Perfect! But again a nasty sidenote.

The url (ex. www.myexampleurl.com/video1/video.mp4) is being generically created by the website (I think for each session). This means I don't have a consistent path to the video to load in my View. The advantage of my first approach with the flashplayer inside the Webview was that the flashplayer does all the work.

Solution to get the correct video-url

No serious problem yet, because I can tackle this problem too. I can do some PHP/DOM-scripting which would scrape the website for the video-url and give it back to my application. This way I always have the generic url and my video can be loaded inside my View. Again that works! And again.. there is a sidenote..

I can not go directly to my website that has the flashplayer. The flow can be as followed:

  1. Enter www.myexampleurl.com/video1.html
  2. Get the message: Wait 5 seconds
  3. Click continue
  4. Video is starting to play inside the flashplayer.

The problem is that I get my video url only after step 3.

Question

Is there a way to solve my getting-the-generic-url problem? Or a better approach to play the video?

-- Is it bad, very bad or extremely bad practice to continue to support flash in Android? I can also just provide the flashplayer .apk and let users install it..

Thanks, hope someone can help me :)!

  • 写回答

2条回答 默认 最新

  • dongshao9106 2012-11-11 13:18
    关注

    Don't do drugs. Don't do flash.

    Get the file up on a server you have control of so you can give a proper path. If that is not an option, you'll have an app that can brake any moment the owner of the website decides to change something with the path.

    评论

报告相同问题?

悬赏问题

  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题