Exemplo n.º 1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(this)) return;
    vPlayerServiceConnection =
        new ServiceConnection() {
          @Override
          public void onServiceConnected(ComponentName name, IBinder service) {
            vPlayer = ((PlayerService.LocalBinder) service).getService();
            mServiceConnected = true;
            if (mSurfaceCreated) vPlayerHandler.sendEmptyMessage(OPEN_FILE);
          }

          @Override
          public void onServiceDisconnected(ComponentName name) {
            vPlayer = null;
            mServiceConnected = false;
          }
        };

    setVolumeControlStream(AudioManager.STREAM_MUSIC);
    parseIntent(getIntent());
    loadView(R.layout.activity_video);
    manageReceivers();

    mCreated = true;
  }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   if (!LibsChecker.checkVitamioLibs(this)) return;
   setListAdapter(
       new SimpleAdapter(
           this,
           getData(),
           android.R.layout.simple_list_item_1,
           new String[] {"title"},
           new int[] {android.R.id.text1}));
 }
Exemplo n.º 3
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (!LibsChecker.checkVitamioLibs(this)) return;
    Intent intent = getIntent();
    contentUri = intent.getData();
    contentId = intent.getStringExtra(CONTENT_ID_EXTRA);

    setContentView(R.layout.player_activity);
    FrameLayout root = (FrameLayout) findViewById(R.id.root);
    setSystemUiVisibility(root);

    // shutterView = findViewById(R.id.shutter);

    surfaceView = (SurfaceView) findViewById(R.id.surface_view);

    holder = surfaceView.getHolder();
    holder.addCallback(this);
    holder.setFormat(PixelFormat.RGBA_8888);

    root.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View view, MotionEvent motionEvent) {
            System.out.println("root.setOnTouchListener");
            if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
              showControls();
              // toggleControlsVisibility();
            } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
              view.performClick();
            }
            return false;
          }
        });

    /*root.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            System.out.println("root.setOnClickListener");
            toggleControlsVisibility();
        }
    });*/

    mediaController = new VideoControllerView(this);
    mediaController.setAnchorView(root);
    mediaController.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            mediaController.hide();
          }
        });
  }
Exemplo n.º 4
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    if (!LibsChecker.checkVitamioLibs(this)) return;
    setContentView(R.layout.mediaplayer_2);
    Bundle bundle = this.getIntent().getExtras();
    String roomid = bundle.getString("roomid");

    path = "rtmp://112.126.80.122:1935/5showcam/stream1069451542";
    mPreview = (SurfaceView) findViewById(R.id.surface);
    holder = mPreview.getHolder();
    holder.addCallback(this);
    holder.setFormat(PixelFormat.RGBA_8888);
    extras = getIntent().getExtras();
  }
Exemplo n.º 5
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   if (!LibsChecker.checkVitamioLibs(this)) return;
   requestWindowFeature(Window.FEATURE_NO_TITLE);
   getWindow()
       .setFlags(
           WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
   setContentView(R.layout.play);
   initView();
   getInitDate();
   setInitDate();
   nextButton.setEnabled(false);
   fontbButton.setEnabled(false);
   play();
 }
Exemplo n.º 6
0
  @Nullable
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_video_feed, container, false);
    ButterKnife.bind(this, view);

    if (!LibsChecker.checkVitamioLibs(getActivity())) return null;

    setupFeed();

    if (savedInstanceState == null) {
      pendingIntroAnimation = true;
    } else {
      feedAdapter.updateItems(false);
    }
    return view;
  }
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(this)) return;

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    extras = getIntent().getExtras();

    // handle extras
    if (extras == null) {
      wrapItUp(RESULT_CANCELED, "Error: No options provided");
    } else {
      if (extras.containsKey("isStreaming")) {
        isStreaming = extras.getBoolean("isStreaming");
      }

      if (extras.containsKey("shouldAutoClose")) {
        mShouldAutoClose = extras.getBoolean("shouldAutoClose");
      }

      mMediaType = extras.getString("type");
      if (mMediaType == null) mMediaType = MEDIA_TYPE_VIDEO;

      mMediaPlayer = new MediaPlayer(this);
      mMediaController = new MediaController(this, !isStreaming);
      mMediaController.setMediaPlayer(this);
      mMediaPlayer.setOnBufferingUpdateListener(this);
      mMediaPlayer.setOnCompletionListener(this);
      mMediaPlayer.setOnErrorListener(this);
      mMediaPlayer.setOnPreparedListener(this);
      mMediaPlayer.setOnVideoSizeChangedListener(this);
      setVolumeControlStream(AudioManager.STREAM_MUSIC);

      RelativeLayout relLayout = new RelativeLayout(this);

      if (extras.containsKey("bgColor")) {
        try {
          bgColor = Color.parseColor(extras.getString("bgColor"));
        } catch (Exception e) {
          Log.v(TAG, "Error parsing color");
          Log.e(TAG, e.toString());
          bgColor = DEFAULT_BG_COLOR;
        }
      }
      relLayout.setBackgroundColor(bgColor);

      RelativeLayout.LayoutParams relLayoutParam =
          new RelativeLayout.LayoutParams(
              RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
      relLayoutParam.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
      mMediaView = new SurfaceView(this);
      mMediaView.setLayoutParams(relLayoutParam);
      relLayout.addView(mMediaView);

      mProgressBar = new ProgressBar(this);
      mProgressBar.setIndeterminate(true);
      mProgressBar.setVisibility(View.VISIBLE);
      RelativeLayout.LayoutParams pblp =
          new RelativeLayout.LayoutParams(
              RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
      pblp.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
      mProgressBar.setLayoutParams(pblp);
      relLayout.addView(mProgressBar);
      mProgressBar.bringToFront();

      mMediaController.setAnchorView(relLayout);
      mMediaController.setEnabled(true);
      if (mMediaType.equalsIgnoreCase(MEDIA_TYPE_AUDIO)) {
        mMediaView.setBackgroundColor(bgColor);
        if (extras.containsKey("bgImage")) {
          if (extras.containsKey("bgImageScaleType")) {
            String scaleType = extras.getString("bgImageScaleType");
            if (scaleType.equalsIgnoreCase("fit")) {
              bgImageScaleType = ImageView.ScaleType.FIT_CENTER;
            } else if (scaleType.equalsIgnoreCase("stretch")) {
              bgImageScaleType = ImageView.ScaleType.FIT_XY;
            } else {
              bgImageScaleType = ImageView.ScaleType.CENTER;
            }
          }
          bgImage = new ImageView(this);
          new ImageLoadTask(extras.getString("bgImage"), this).execute(null, null);
          RelativeLayout.LayoutParams bgImageLayoutParam =
              new RelativeLayout.LayoutParams(
                  RelativeLayout.LayoutParams.MATCH_PARENT,
                  RelativeLayout.LayoutParams.MATCH_PARENT);
          bgImageLayoutParam.addRule(RelativeLayout.CENTER_IN_PARENT);
          bgImage.setLayoutParams(bgImageLayoutParam);
          bgImage.setScaleType(bgImageScaleType);
          relLayout.addView(bgImage);
        }
      }
      setContentView(relLayout, relLayoutParam);
      holder = mMediaView.getHolder();
      holder.addCallback(this);
      holder.setFormat(PixelFormat.RGBA_8888);
    }
  }