OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.domokit.media; |
| 6 |
| 7 import android.content.ActivityNotFoundException; |
| 8 import android.content.Context; |
| 9 import android.net.Uri; |
| 10 import android.util.Log; |
| 11 |
| 12 import org.chromium.mojo.system.Core; |
| 13 import org.chromium.mojo.system.MojoException; |
| 14 import org.chromium.mojo.bindings.InterfaceRequest; |
| 15 import org.chromium.mojom.media.MediaService; |
| 16 import org.chromium.mojom.media.MediaPlayer; |
| 17 |
| 18 import java.io.IOException; |
| 19 import java.util.concurrent.ExecutorService; |
| 20 import java.util.concurrent.Executors; |
| 21 |
| 22 |
| 23 /** |
| 24 * Android implementation of MediaService. |
| 25 */ |
| 26 public class MediaServiceImpl implements MediaService { |
| 27 private static final String TAG = "MediaServiceImpl"; |
| 28 private final Core mCore; |
| 29 private final Context mContext; |
| 30 private static ExecutorService sThreadPool; |
| 31 |
| 32 public MediaServiceImpl(Context context, Core core) { |
| 33 assert context != null; |
| 34 mContext = context; |
| 35 assert core != null; |
| 36 mCore = core; |
| 37 |
| 38 if (sThreadPool == null) { |
| 39 sThreadPool = Executors.newCachedThreadPool(); |
| 40 } |
| 41 } |
| 42 |
| 43 @Override |
| 44 public void close() {} |
| 45 |
| 46 @Override |
| 47 public void onConnectionError(MojoException e) {} |
| 48 |
| 49 @Override |
| 50 public void createPlayer(InterfaceRequest<MediaPlayer> player) { |
| 51 Log.e(TAG, "createPlayer"); |
| 52 MediaPlayer.MANAGER.bind(new MediaPlayerImpl(mCore, mContext, sThreadPoo
l), player); |
| 53 } |
| 54 } |
OLD | NEW |