Android浏览器的媒体播放器(stagefright?)显示的介质名称 [英] Android browser media player (stagefright?) displayed media name

查看:146
本文介绍了Android浏览器的媒体播放器(stagefright?)显示的介质名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android浏览器中打开的媒体文件就可以播放,内置(stagefright?)媒体播放器打开了流了。针对此媒体标题显示在播放器对话框,基于URL。

在这种情况下,网址是 http://10.0.37.195/waug_mp3_128k 。媒体播放器只需使用路径作为其名称的最后部分。

是否有可能改变显示的标题?

我已经尝试了内容处置头,但没有任何效果:

 内容处置:内联;文件名=一些更好的标题


解决方案

简短的答案是否定的。我不认为你可以改变显示的标题,显示从服务器别的东西。

我相信球员是默认的<一个href=\"http://omapzoom.org/?p=platform/packages/apps/Music.git;a=blob;f=src/com/android/music/Audio$p$pview.java;hb=HEAD\"相对=nofollow>从默认的AOSP音乐应用音频preVIEW 活动。看着它的源$ C ​​$ C,显然它将使用HTTP方案简单地使用URI的最后一个路径段的流(它只会查询本地内容/文件的媒体数据库)。

下面是相关code片段:

  @覆盖
公共无效的onCreate(捆绑冰柱){
    super.onCreate(冰柱);    // ...    如果(scheme.equals(ContentResolver.SCHEME_CONTENT)){        // ...    }否则如果(scheme.equals(文件)){        // ...    }其他{
        //我们不能从文件中获取元数据/流本身,但因为
        //该API是隐藏的,所以我们反而显示URI正在播放
        如果(mPlayer.is prepared()){
            setNames();
        }
    }
}// ...公共无效setNames(){
    如果(TextUtils.isEmpty(mTextLine1.getText())){
        mTextLine1.setText(mUri.getLastPathSegment());
    }
    如果(TextUtils.isEmpty(mTextLine2.getText())){
        mTextLine2.setVisibility(View.GONE);
    }其他{
        mTextLine2.setVisibility(View.VISIBLE);
    }
}

When the Android browser opens a media file it can play, the built-in (stagefright?) media player opens up to stream it. A title for this media is displayed on the player dialog, based on the URL.

The URL in this case was http://10.0.37.195/waug_mp3_128k. The media player simply uses the last part of the path as its title.

Is it possible to change the displayed title?

I have tried a Content-Disposition header, but it had no effect:

Content-Disposition: inline; filename=Some Better Title

解决方案

The short answer is no. I don't think you can change the displayed title to show something else from the server.

I believe that player is the default AudioPreview activity from the default AOSP Music app. Looking at it's source code, apparently it will simply use the last path segment of the URI for stream using the HTTP scheme (it will only query the media database for local content/files).

Here are the relevant code snippets:

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    // ...

    if (scheme.equals(ContentResolver.SCHEME_CONTENT)) {

        // ...

    } else if (scheme.equals("file")) {

        // ...

    } else {
        // We can't get metadata from the file/stream itself yet, because
        // that API is hidden, so instead we display the URI being played
        if (mPlayer.isPrepared()) {
            setNames();
        }
    }
}

// ...

public void setNames() {
    if (TextUtils.isEmpty(mTextLine1.getText())) {
        mTextLine1.setText(mUri.getLastPathSegment());
    }
    if (TextUtils.isEmpty(mTextLine2.getText())) {
        mTextLine2.setVisibility(View.GONE);
    } else {
        mTextLine2.setVisibility(View.VISIBLE);
    }
}

这篇关于Android浏览器的媒体播放器(stagefright?)显示的介质名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆