0

Surface View has a method called getSurfaceHolder() which TextureView don't have. After digging into the source code, I am wondering is it possible to implement a getSurfaceHolder() in Textureview? Is anybody tried that?

We have a bunch of things needs to be implemented.Is possible to implement using textureview? any suggestions?

new SurfaceHolder() {
                @Override
                public void addCallback(Callback callback) {

                }

                @Override
                public void removeCallback(Callback callback) {

                }

                @Override
                public boolean isCreating() {
                    return false;
                }

                @Override
                public void setType(int type) {

                }

                @Override
                public void setFixedSize(int width, int height) {

                }

                @Override
                public void setSizeFromLayout() {

                }

                @Override
                public void setFormat(int format) {

                }

                @Override
                public void setKeepScreenOn(boolean screenOn) {

                }

                @Override
                public Canvas lockCanvas() {
                    return null;
                }

                @Override
                public Canvas lockCanvas(Rect dirty) {
                    return null;
                }

                @Override
                public void unlockCanvasAndPost(Canvas canvas) {

                }

                @Override
                public Rect getSurfaceFrame() {
                    return null;
                }

                @Override
                public Surface getSurface() {
                    return null;
                }
            }
Jay Rathod
  • 11,131
  • 6
  • 34
  • 58
wukong
  • 2,430
  • 2
  • 26
  • 33
  • what do you need `SurfaceHolder` in `TextureView` for? – pskink Sep 06 '16 at 06:54
  • mediaplayer.setSurface and mediaplayer.setDisplay behaves differently. Thus When mediaplayer is playing, calling setSurface the video will be interrupt, the video sound will stop a little of time then start again. setDisplay have no such problems. – wukong Sep 06 '16 at 10:04
  • so see in what they differ: http://androidxref.com/7.0.0_r1/xref/frameworks/base/media/java/android/media/MediaPlayer.java#715 and http://androidxref.com/7.0.0_r1/xref/frameworks/base/media/java/android/media/MediaPlayer.java#747 – pskink Sep 06 '16 at 10:11
  • @pskink Thanks for the source code. Maybe setSurface and setDisplay is not the root cause of my problem. I will check again. – wukong Sep 06 '16 at 12:28

0 Answers0