1

我想将我的视频流式传输到手机上的外部播放器。我安装了双重扭曲,我希望它打开我的视频 URL。我怎样才能做到这一点?

4

2 回答 2

11

It is a good practice to let user of your app to select the Video player he likes to play your Video

Create a Intent Chooser which lets your user choose a Video player of his choice and play the file.

public class MainActivity extends Activity implements OnClickListener {

    private Button btn;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btn = (Button) findViewById(R.id.button1);
        btn.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.button1) {
            Intent intent = new Intent(Intent.ACTION_VIEW);

            intent.setDataAndType(Uri.parse("http://ur URL"), "video/*");

            startActivity(Intent.createChooser(intent, "Complete action using"));
        }

    }

}
于 2012-10-05T06:25:26.660 回答
0

我用这个代码触发了我的二维码扫描器,我想你可以找到 doubleTwist 的包和活动名称(我手边没有这个播放器,否则我会发现的)。在下面使用类似的东西 -

Intent intent = new Intent("com.google.zxing.client.android.SCAN");  
        intent.putExtra("SCAN_MODE", "QR_CODE_MODE");    
        startActivityForResult(intent, 0);

我不确定你会从哪里点击你的 URL,从任何 web 视图或本地组件,因为根据它们,点击的事件处理会改变。

于 2012-10-05T07:23:25.863 回答