1. Download our Official Android App: Forums for Android!

Apps Android app embed flash video doesn't work

Discussion in 'Android Development' started by rushhh, Apr 17, 2011.

  1. rushhh

    rushhh Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Apr 17, 2011

    Apr 17, 2011
    2
    0
    5
    Hi. I am trying to get embed flash video on webview from IMDb Video: Hannibal.
    I tryed with:
    Code (Text):
    1.  
    2. String html = "<object width=\"425\" height=\"344\"><param value=\"youTUBElink"><embed src=\"youtTUBElink\"  type=\"application/x-shockwave-flash\"  allowfullscreen=\"true\"  allowscriptaccess=\"always\"  width=\"425\" height=\"344\"></embed></param></object>";
    3.         String mimeType = "text/html";
    4.         String encoding = "utf-8";
    5.  
    6.                 WebView webview = (WebView) findViewById(R.id.web);
    7.        
    8.         webview.getSettings().setPluginsEnabled(true);
    9.        
    10.         webview.getSettings().setJavaScriptEnabled(true);
    11.        
    12.         webview.loadData(html ,"text/html", "UTF-8");
    13.  
    That doesn't work for me.. Just blank screen.

    Code (Text):
    1.  
    2. String html = "<html> <body><embed src=\"http://www.imdb.com/video/imdb/vi1011875865\" type=\"application/x-shockwave-flash\" width=\"200\" height=\"200\"></embed>TEST</body> </html>";
    3.  
    Same...
    Tryed with webview.loadDatBaseURL(null, html, "text/html", "UTF-8", "");

    Nothing..

    Only thing that works is
    Code (Text):
    1.  
    2. String html2="<iframe class=\"youtube-player\" autohide=\"1\" type=\"text/html\" allowfullscreen=\"true\" width=\"300\" height=\"300\" src=\"http://www.youtube.com/embed/NRHTdNWhAc8?fs=1 frameborder=\"0\">";
    3.  
    But only youtube videos.

    Can you help me please!

    PS: I am testin on 2.2 Froyo device.
     

    Advertisement

  2. sencha

    sencha Lurker
    Rank:
    None
    Points:
    5
    Posts:
    1
    Joined:
    Apr 24, 2011

    Apr 24, 2011
    1
    0
    5
    android embed flash video:android not support dynamic load url.
    you can try anonther method?
     
  3. rajeev16mca2k5

    Rank:
    None
    Points:
    5
    Posts:
    1
    Joined:
    Oct 8, 2011

    Oct 8, 2011
    1
    0
    5
    Hi russh,
    can you send me code to embed youtube video. i tried the third option you provided, it shows me video player, with initial pic, but when i start it manually, it does not plays video.
    My email id is rajeev16mca2k5@gmail.com.
    I am new in android and dont know much about it, so, its better, if you will send me some sample code itself.
    Thanks,
    Rajeev Singh
    Sr. Sw Engg
     
  4. steve

    steve Developer
    Administrator
    Rank:
    None
    Points:
    573
    Posts:
    1,086
    Joined:
    Apr 19, 2011

    Apr 19, 2011
    1,086
    1,178
    573
    Male
    Android Developer
    York, PA
    Try to start off with more of a basic way of loading a video. What I would do is download one that does NOT work (using a swf downloader via browser). Then drop this into your assets folder and use something simular to this:

    Code (Text):
    1.  webview.loadUrl("file:///android_asset/test.swf");
    2.  
    If that does indeed work, then I would host that same file on my own server and do a test with how it streams to figure out what is causing the issue your seeing. Since YouTube works... it must be something on how the WebView is seeing the swf file.
     

Share This Page

Loading...