Search in sources :

Example 1 with RenderingWidget

use of android.media.SubtitleTrack.RenderingWidget in project android_frameworks_base by ResurrectionRemix.

the class MediaPlayer method setSubtitleAnchor.

/**
     * The private version of setSubtitleAnchor is used internally to set mSubtitleController if
     * necessary when clients don't provide their own SubtitleControllers using the public version
     * {@link #setSubtitleAnchor(SubtitleController, Anchor)} (e.g. {@link VideoView} provides one).
     */
private synchronized void setSubtitleAnchor() {
    if (mSubtitleController == null) {
        final HandlerThread thread = new HandlerThread("SetSubtitleAnchorThread");
        thread.start();
        Handler handler = new Handler(thread.getLooper());
        handler.post(new Runnable() {

            @Override
            public void run() {
                Context context = ActivityThread.currentApplication();
                mSubtitleController = new SubtitleController(context, mTimeProvider, MediaPlayer.this);
                mSubtitleController.setAnchor(new Anchor() {

                    @Override
                    public void setSubtitleWidget(RenderingWidget subtitleWidget) {
                    }

                    @Override
                    public Looper getSubtitleLooper() {
                        return Looper.getMainLooper();
                    }
                });
                thread.getLooper().quitSafely();
            }
        });
        try {
            thread.join();
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            Log.w(TAG, "failed to join SetSubtitleAnchorThread");
        }
    }
}
Also used : Context(android.content.Context) SubtitleController(android.media.SubtitleController) Anchor(android.media.SubtitleController.Anchor) HandlerThread(android.os.HandlerThread) Runnable(java.lang.Runnable) Handler(android.os.Handler) RenderingWidget(android.media.SubtitleTrack.RenderingWidget)

Example 2 with RenderingWidget

use of android.media.SubtitleTrack.RenderingWidget in project android_frameworks_base by DirtyUnicorns.

the class MediaPlayer method setSubtitleAnchor.

/**
     * The private version of setSubtitleAnchor is used internally to set mSubtitleController if
     * necessary when clients don't provide their own SubtitleControllers using the public version
     * {@link #setSubtitleAnchor(SubtitleController, Anchor)} (e.g. {@link VideoView} provides one).
     */
private synchronized void setSubtitleAnchor() {
    if (mSubtitleController == null) {
        final HandlerThread thread = new HandlerThread("SetSubtitleAnchorThread");
        thread.start();
        Handler handler = new Handler(thread.getLooper());
        handler.post(new Runnable() {

            @Override
            public void run() {
                Context context = ActivityThread.currentApplication();
                mSubtitleController = new SubtitleController(context, mTimeProvider, MediaPlayer.this);
                mSubtitleController.setAnchor(new Anchor() {

                    @Override
                    public void setSubtitleWidget(RenderingWidget subtitleWidget) {
                    }

                    @Override
                    public Looper getSubtitleLooper() {
                        return Looper.getMainLooper();
                    }
                });
                thread.getLooper().quitSafely();
            }
        });
        try {
            thread.join();
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            Log.w(TAG, "failed to join SetSubtitleAnchorThread");
        }
    }
}
Also used : Context(android.content.Context) SubtitleController(android.media.SubtitleController) Anchor(android.media.SubtitleController.Anchor) HandlerThread(android.os.HandlerThread) Runnable(java.lang.Runnable) Handler(android.os.Handler) RenderingWidget(android.media.SubtitleTrack.RenderingWidget)

Example 3 with RenderingWidget

use of android.media.SubtitleTrack.RenderingWidget in project android_frameworks_base by crdroidandroid.

the class MediaPlayer method setSubtitleAnchor.

/**
     * The private version of setSubtitleAnchor is used internally to set mSubtitleController if
     * necessary when clients don't provide their own SubtitleControllers using the public version
     * {@link #setSubtitleAnchor(SubtitleController, Anchor)} (e.g. {@link VideoView} provides one).
     */
private synchronized void setSubtitleAnchor() {
    if (mSubtitleController == null) {
        final HandlerThread thread = new HandlerThread("SetSubtitleAnchorThread");
        thread.start();
        Handler handler = new Handler(thread.getLooper());
        handler.post(new Runnable() {

            @Override
            public void run() {
                Context context = ActivityThread.currentApplication();
                mSubtitleController = new SubtitleController(context, mTimeProvider, MediaPlayer.this);
                mSubtitleController.setAnchor(new Anchor() {

                    @Override
                    public void setSubtitleWidget(RenderingWidget subtitleWidget) {
                    }

                    @Override
                    public Looper getSubtitleLooper() {
                        return Looper.getMainLooper();
                    }
                });
                thread.getLooper().quitSafely();
            }
        });
        try {
            thread.join();
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            Log.w(TAG, "failed to join SetSubtitleAnchorThread");
        }
    }
}
Also used : Context(android.content.Context) SubtitleController(android.media.SubtitleController) Anchor(android.media.SubtitleController.Anchor) HandlerThread(android.os.HandlerThread) Runnable(java.lang.Runnable) Handler(android.os.Handler) RenderingWidget(android.media.SubtitleTrack.RenderingWidget)

Example 4 with RenderingWidget

use of android.media.SubtitleTrack.RenderingWidget in project platform_frameworks_base by android.

the class MediaPlayer method setSubtitleAnchor.

/**
     * The private version of setSubtitleAnchor is used internally to set mSubtitleController if
     * necessary when clients don't provide their own SubtitleControllers using the public version
     * {@link #setSubtitleAnchor(SubtitleController, Anchor)} (e.g. {@link VideoView} provides one).
     */
private synchronized void setSubtitleAnchor() {
    if (mSubtitleController == null) {
        final HandlerThread thread = new HandlerThread("SetSubtitleAnchorThread");
        thread.start();
        Handler handler = new Handler(thread.getLooper());
        handler.post(new Runnable() {

            @Override
            public void run() {
                Context context = ActivityThread.currentApplication();
                mSubtitleController = new SubtitleController(context, mTimeProvider, MediaPlayer.this);
                mSubtitleController.setAnchor(new Anchor() {

                    @Override
                    public void setSubtitleWidget(RenderingWidget subtitleWidget) {
                    }

                    @Override
                    public Looper getSubtitleLooper() {
                        return Looper.getMainLooper();
                    }
                });
                thread.getLooper().quitSafely();
            }
        });
        try {
            thread.join();
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            Log.w(TAG, "failed to join SetSubtitleAnchorThread");
        }
    }
}
Also used : Context(android.content.Context) SubtitleController(android.media.SubtitleController) Anchor(android.media.SubtitleController.Anchor) HandlerThread(android.os.HandlerThread) Runnable(java.lang.Runnable) Handler(android.os.Handler) RenderingWidget(android.media.SubtitleTrack.RenderingWidget)

Example 5 with RenderingWidget

use of android.media.SubtitleTrack.RenderingWidget in project android_frameworks_base by AOSPA.

the class MediaPlayer method setSubtitleAnchor.

/**
     * The private version of setSubtitleAnchor is used internally to set mSubtitleController if
     * necessary when clients don't provide their own SubtitleControllers using the public version
     * {@link #setSubtitleAnchor(SubtitleController, Anchor)} (e.g. {@link VideoView} provides one).
     */
private synchronized void setSubtitleAnchor() {
    if (mSubtitleController == null) {
        final HandlerThread thread = new HandlerThread("SetSubtitleAnchorThread");
        thread.start();
        Handler handler = new Handler(thread.getLooper());
        handler.post(new Runnable() {

            @Override
            public void run() {
                Context context = ActivityThread.currentApplication();
                mSubtitleController = new SubtitleController(context, mTimeProvider, MediaPlayer.this);
                mSubtitleController.setAnchor(new Anchor() {

                    @Override
                    public void setSubtitleWidget(RenderingWidget subtitleWidget) {
                    }

                    @Override
                    public Looper getSubtitleLooper() {
                        return Looper.getMainLooper();
                    }
                });
                thread.getLooper().quitSafely();
            }
        });
        try {
            thread.join();
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            Log.w(TAG, "failed to join SetSubtitleAnchorThread");
        }
    }
}
Also used : Context(android.content.Context) SubtitleController(android.media.SubtitleController) Anchor(android.media.SubtitleController.Anchor) HandlerThread(android.os.HandlerThread) Runnable(java.lang.Runnable) Handler(android.os.Handler) RenderingWidget(android.media.SubtitleTrack.RenderingWidget)

Aggregations

Context (android.content.Context)5 SubtitleController (android.media.SubtitleController)5 Anchor (android.media.SubtitleController.Anchor)5 RenderingWidget (android.media.SubtitleTrack.RenderingWidget)5 Handler (android.os.Handler)5 HandlerThread (android.os.HandlerThread)5 Runnable (java.lang.Runnable)5