Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
跳过帧。应用程序可能在它上面做了太多的工作';s主螺纹&x201D;android 4.3 nexus 7上的错误 导入java.io.BufferedReader; 公共类主扩展活动实现SurfaceHolder.Callback, MediaPlayer.OnCompletionListener、View.OnClickListener、OnInitListener{ 字符串SrcPath=“”; MediaPlayer mp; SurfaceView mSurfaceView; 私人表面股东控股公司; 布尔播放=假; 字符串t_alarm1=“alarm.xml”,t_alarm2=“alarm2.xml”,文本; //桃子 私有TextToSpeech mText2Speech; @凌驾 创建时受保护的void(Bundle savedInstanceState){ StrictMode.ThreadPolicy policy=新建StrictMode.ThreadPolicy.Builder() .permitAll().build(); StrictMode.setThreadPolicy(策略); super.onCreate(savedInstanceState); setContentView(R.layout.main); addListenerOnButton(); mText2Speech=newtexttospeech(Main.this,Main.this); } //门吕 @凌驾 公共布尔onCreateOptions菜单(菜单){ //为菜单充气;这会将项目添加到操作栏(如果存在)。 getMenuInflater().充气(R.menu.main,menu); 返回true; } @凌驾 公共布尔值onOptionsItemSelected(菜单项项){ 开关(item.getItemId()){ 案例R.id.action\u设置:{ Intent myIntent=新的Intent(这个,menu.class); Main.this.startActivity(myIntent); 返回true; } } 返回true; } //基列佩斯菲格耶尔酒店 私有静态最终长双_按_间隔=2000000000;//2 másodperc 私人长时间; @凌驾 public void onBackPressed(){ Toast.makeText(Main.this、getString(R.string.kilepes_dupla), 吐司。长度(短)。show(); 长按时间=System.nanoTime(); 如果(pressTime-lastPressTime_Android_Video_Rtsp - Fatal编程技术网

跳过帧。应用程序可能在它上面做了太多的工作';s主螺纹&x201D;android 4.3 nexus 7上的错误 导入java.io.BufferedReader; 公共类主扩展活动实现SurfaceHolder.Callback, MediaPlayer.OnCompletionListener、View.OnClickListener、OnInitListener{ 字符串SrcPath=“”; MediaPlayer mp; SurfaceView mSurfaceView; 私人表面股东控股公司; 布尔播放=假; 字符串t_alarm1=“alarm.xml”,t_alarm2=“alarm2.xml”,文本; //桃子 私有TextToSpeech mText2Speech; @凌驾 创建时受保护的void(Bundle savedInstanceState){ StrictMode.ThreadPolicy policy=新建StrictMode.ThreadPolicy.Builder() .permitAll().build(); StrictMode.setThreadPolicy(策略); super.onCreate(savedInstanceState); setContentView(R.layout.main); addListenerOnButton(); mText2Speech=newtexttospeech(Main.this,Main.this); } //门吕 @凌驾 公共布尔onCreateOptions菜单(菜单){ //为菜单充气;这会将项目添加到操作栏(如果存在)。 getMenuInflater().充气(R.menu.main,menu); 返回true; } @凌驾 公共布尔值onOptionsItemSelected(菜单项项){ 开关(item.getItemId()){ 案例R.id.action\u设置:{ Intent myIntent=新的Intent(这个,menu.class); Main.this.startActivity(myIntent); 返回true; } } 返回true; } //基列佩斯菲格耶尔酒店 私有静态最终长双_按_间隔=2000000000;//2 másodperc 私人长时间; @凌驾 public void onBackPressed(){ Toast.makeText(Main.this、getString(R.string.kilepes_dupla), 吐司。长度(短)。show(); 长按时间=System.nanoTime(); 如果(pressTime-lastPressTime

跳过帧。应用程序可能在它上面做了太多的工作';s主螺纹&x201D;android 4.3 nexus 7上的错误 导入java.io.BufferedReader; 公共类主扩展活动实现SurfaceHolder.Callback, MediaPlayer.OnCompletionListener、View.OnClickListener、OnInitListener{ 字符串SrcPath=“”; MediaPlayer mp; SurfaceView mSurfaceView; 私人表面股东控股公司; 布尔播放=假; 字符串t_alarm1=“alarm.xml”,t_alarm2=“alarm2.xml”,文本; //桃子 私有TextToSpeech mText2Speech; @凌驾 创建时受保护的void(Bundle savedInstanceState){ StrictMode.ThreadPolicy policy=新建StrictMode.ThreadPolicy.Builder() .permitAll().build(); StrictMode.setThreadPolicy(策略); super.onCreate(savedInstanceState); setContentView(R.layout.main); addListenerOnButton(); mText2Speech=newtexttospeech(Main.this,Main.this); } //门吕 @凌驾 公共布尔onCreateOptions菜单(菜单){ //为菜单充气;这会将项目添加到操作栏(如果存在)。 getMenuInflater().充气(R.menu.main,menu); 返回true; } @凌驾 公共布尔值onOptionsItemSelected(菜单项项){ 开关(item.getItemId()){ 案例R.id.action\u设置:{ Intent myIntent=新的Intent(这个,menu.class); Main.this.startActivity(myIntent); 返回true; } } 返回true; } //基列佩斯菲格耶尔酒店 私有静态最终长双_按_间隔=2000000000;//2 másodperc 私人长时间; @凌驾 public void onBackPressed(){ Toast.makeText(Main.this、getString(R.string.kilepes_dupla), 吐司。长度(短)。show(); 长按时间=System.nanoTime(); 如果(pressTime-lastPressTime,android,video,rtsp,Android,Video,Rtsp,简单来说,此错误意味着您要求您的Android系统在这个特定应用程序的主线程上做太多的工作。对于此错误有一些很好的一般性答案,一个很好的例子是: 对于您的具体示例,您可能只是要求它在主线程上做太多视频相关的工作,这是非常需要处理器的。例如,查看您的“准备”方法,如果您使用流式源,请考虑使用PraseRasyCH——参见Android文档: public void prepareAsync() 添加到API级别1中,使播放机为异步播放做好准备。 设置数据源和显示表面后,需要 调用prepare(

简单来说,此错误意味着您要求您的Android系统在这个特定应用程序的主线程上做太多的工作。对于此错误有一些很好的一般性答案,一个很好的例子是:

对于您的具体示例,您可能只是要求它在主线程上做太多视频相关的工作,这是非常需要处理器的。例如,查看您的“准备”方法,如果您使用流式源,请考虑使用PraseRasyCH——参见Android文档:

public void prepareAsync()

添加到API级别1中,使播放机为异步播放做好准备。 设置数据源和显示表面后,需要 调用prepare()或prepareAsync()。对于流,应该调用 prepareAsync(),它立即返回,而不是直到 缓冲了足够的数据


你可能会在Nexus 7而不是Galaxy 3上看到问题的一个原因是Nexus的屏幕大得多,而且你的视频源可能会为不同大小的设备提供不同的视频编码——较大的设备很可能需要更多的处理来解码和渲染。

你找到了发生这种情况的原因吗?我也是仅在少数设备上面临类似问题
import java.io.BufferedReader;

public class Main extends Activity implements SurfaceHolder.Callback,
        MediaPlayer.OnCompletionListener, View.OnClickListener, OnInitListener {

    String SrcPath = "";
    MediaPlayer mp;
    SurfaceView mSurfaceView;
    private SurfaceHolder holderrrr;
    Boolean play = false;
    String t_alarm1 = "alarm.xml", t_alarm2 = "alarm2.xml", text;

    // TextToSpeach
    private TextToSpeech mText2Speech;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
                .permitAll().build();
        StrictMode.setThreadPolicy(policy);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        addListenerOnButton();
        mText2Speech = new TextToSpeech(Main.this, Main.this);

    }

    // menü
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {

        case R.id.action_settings: {
            Intent myIntent = new Intent(this, menu.class);
            Main.this.startActivity(myIntent);
            return true;
        }

        }

        return true;
    }

    // kilépésfigyelő

    private static final long DOUBLE_PRESS_INTERVAL = 2000000000;// 2 másodperc
    private long lastPressTime;

    @Override
    public void onBackPressed() {
        Toast.makeText(Main.this, getString(R.string.kilepes_dupla),
                Toast.LENGTH_SHORT).show();
        long pressTime = System.nanoTime();
        if (pressTime - lastPressTime <= DOUBLE_PRESS_INTERVAL) {
            // this is a double click event
            System.exit(0);

        }
        lastPressTime = pressTime;

    }

    public void onInit(int status) {

        if (status == TextToSpeech.SUCCESS) {
            mText2Speech.setLanguage(Locale.getDefault()); // alaértelmezett
                                                            // nyelv a TtS-hez
        }

    }

    private void addListenerOnButton() {
        final Button button5 = (Button) findViewById(R.id.button5);


                    button5.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                // Perform action on click
                if (play) {
                    try{
                        mp.stop();
                        mp.release();
                        mp = null;
                    }catch(Exception e){

                    }

                    button5.setText("Start");
                    play = false;

                } else {
                    try {
                        mp = new MediaPlayer();
                        mSurfaceView = (SurfaceView) findViewById(R.id.surface);
                        holderrrr = mSurfaceView.getHolder();
                        play = true;
                        button5.setText("Stop");
                        surfaceCreated(holderrrr);
                    } catch (IllegalArgumentException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    } catch (SecurityException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    } catch (IllegalStateException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }

            }
        });

    }// addlistener vége


    public void surfaceCreated(SurfaceHolder holder) {

        mp.setDisplay(holder);

        holder = mSurfaceView.getHolder();
        holder.addCallback(this);
        holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
        try {
            mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
                @Override
                public void onCompletion(MediaPlayer mp) {

                    mp.stop();
                    mp.release();
                    Toast.makeText(Main.this,
                            "A videó lejátszás befejeződött!",
                            Toast.LENGTH_SHORT).show();
                    // button5.setText("Start");
                    //play = false;


                }
            });
            mp.setDataSource(SrcPath);
            mp.prepare();

        } catch (IllegalArgumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SecurityException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalStateException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        // Get the dimensions of the video
        // int videoWidth = mp.getVideoWidth();
        // int videoHeight = mp.getVideoHeight();

        // Get the width of the screen
        // int screenWidth = getWindowManager().getDefaultDisplay().getWidth();

        // Get the SurfaceView layout parameters
        android.view.ViewGroup.LayoutParams lp = mSurfaceView.getLayoutParams();

        // Set the width of the SurfaceView to the width of the screen
        // lp.width = screenWidth;
        lp.width = 420;

        // Set the height of the SurfaceView to match the aspect ratio of the
        // video
        // be sure to cast these as floats otherwise the calculation will likely
        // be 0
        // lp.height = (int) (((float) videoHeight / (float) videoWidth) *
        // (float) screenWidth);
        lp.height = 390;

        // Commit the layout parameters
        mSurfaceView.setLayoutParams(lp);

        // Start video
        mp.start();
    }


            }



        }