Youtube视频播放错误

时间:2012-11-02 13:54:13

标签: android video youtube

以下是我的源代码。当我尝试在我的Android模拟器3.0上播放这些时,我有一些youtube视频ID,一些视频在正确加载后运行良好。但是有些视频需要花费更多时间,最后应用程序会被关闭。我在这里给了两个youtube id's

  1. Ju2Krqv9aDU(运行良好)
  2. IqZf2pj4oj8(进度对话框需要更多时间,最后强行关闭)
  3. 我在这里发布了源代码和错误日志。

    MainLayout.java

    package com.redorange.motutv;
    
    import android.app.Activity;
    import android.app.Fragment;
    import android.app.FragmentTransaction;
    import android.app.ProgressDialog;
    import android.os.AsyncTask;
    import android.os.Bundle;
    import android.util.Log;
    import android.widget.TextView;
    import com.redorange.blanklayout_for_initialview.InitialTempFragmentPage;
    import com.redorange.dramas.ListOfCategoriesDrama;
    import com.redorange.livetv.ListOfCountry;
    import com.redorange.motutvstaticdata.MotuTVFunctions;
    import com.redorange.motutvstaticdata.MotuTVStaticData;
    import com.redorange.movies.ListOfCategoriesMovie;
    
    public class MainLayout extends Activity {
    
        TextView tvSelectedOptionName;
        TextView tvDate;
        TextView tvUserName;
        Fragment leftLayout;
        Fragment rightLayout;
        ProgressDialog progressDialog;
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            tvDate = (TextView) findViewById(R.id.tvDate);
            tvDate.setText(MotuTVFunctions.getCurrentDate());
    
            tvUserName = (TextView) findViewById(R.id.tvUserName);
            tvUserName.setText("Hi " + MotuTVStaticData.save_username);
    
            if (MotuTVStaticData.save_selectedOptionName.equals("Live TV")) {
                leftLayout = new ListOfCountry();
                // rightLayout = new GridViewWeb1();
                rightLayout = new InitialTempFragmentPage();
            } else if (MotuTVStaticData.save_selectedOptionName.equals("Movie")) {
                leftLayout = new ListOfCategoriesMovie();
                // rightLayout = new GridViewWebMovie();
                rightLayout = new InitialTempFragmentPage();
            } else if (MotuTVStaticData.save_selectedOptionName.equals("Drama")) {
                leftLayout = new ListOfCategoriesDrama();
                // rightLayout = new GridViewWebDrama();
                rightLayout = new InitialTempFragmentPage();
            }
            new BackgrndProcessForInitialSettings().execute();
        }
    
        public void setLeftRightLayout() {
            FragmentTransaction newtransaction = getFragmentManager()
                    .beginTransaction();
    
    
            newtransaction.replace(R.id.myfragmentleft, leftLayout);
            newtransaction.replace(R.id.myfragmentright, rightLayout);
            newtransaction.addToBackStack(null);
            newtransaction.commit();
    
        }
    
        @Override
        public void onBackPressed() {
            finish();
        }
    
        public class BackgrndProcessForInitialSettings extends
                AsyncTask<Void, Void, Integer> {
            @Override
            protected void onPreExecute() {
                super.onPreExecute();
                progressDialog = ProgressDialog.show(MainLayout.this, "",
                        "please wait...");
    
            }
    
            @Override
            protected Integer doInBackground(Void... params) {
    
                setLeftRightLayout();
                return 1;
            }
    
            @Override
            protected void onPostExecute(Integer result) {
    
                progressDialog.dismiss();
                super.onPostExecute(result);
            }
        }
    
    }
    

    错误日志:1 enter image description here

    错误日志:2 enter image description here

    错误日志:3

    enter image description here

0 个答案:

没有答案