• 大小: 2.73MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-14
  • 语言: Java
  • 标签: DLNA  android  

资源简介

android DLNA投屏,支持网络在线视频,具体代码欢迎下载观看

资源截图

代码片段和文件信息

package com.xiaowei.media.library.util;

import android.util.Log;

import com.cling.support.model.DIDLobject;
import com.cling.support.model.ProtocolInfo;
import com.cling.support.model.Res;
import com.cling.support.model.item.VideoItem;

import org.seamless.util.MimeType;

import java.text.SimpleDateFormat;
import java.util.Date;


public class TvUtil {
    public static String pushMediaToRender(String url String id String name String duration String creator) {
        long size = 0;
        long bitrate = 0;
        Res res = new Res(new MimeType(ProtocolInfo.WILDCARD ProtocolInfo.WILDCARD) size url);

        VideoItem videoItem = new VideoItem(id “0“ name creator res);

        String metadata = createItemmetadata(videoItem);
        return metadata;
    }

    private static String DIDL_LITE_HEADER = “lns=\“urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\““ +
            “ xmlns:upnp=\“urn:schemas-upnp-org:metadata-1-0/upnp/\“ “ +
            “xmlns:dc=\“http://purl.org/dc/elements/1.1/\“ “ +
            “xmlns:dlna=\“urn:schemas-dlna-org:metadata-1-0/\“ xmlns:sec=\“http://www.sec.co.kr/\“>“;
    private static String DIDL_LITE_FOOTER = ““;

    public static String createItemmetadata(DIDLobject item) {
        StringBuilder metadata = new StringBuilder();
        metadata.append(DIDL_LITE_HEADER);

        metadata.append(String.format(““ item.getId() item.getParentID() item.isRestricted() ? “1“ : “0“));

        metadata.append(String.format(“tle>%stle>“ item.gettitle()));
        String creator = item.getCreator();
        if (creator != null) {
            creator = creator.replaceAll(“<“ “_“);
            creator = creator.replaceAll(“>“ “_“);
        }
        metadata.append(String.format(“%s“ creator));
        metadata.append(String.format(“%s“ item.getClazz().getValue()));

        SimpleDateFormat sdf = new SimpleDateFormat(“yyyy-MM-dd‘T‘HH:mm:ss“);
        Date now = new Date();
        String time = sdf.format(now);
        metadata.append(String.format(“%s“ time));

        Res res = item.getFirstResource();
        if (res != null) {
            // protocol info
            String protocolinfo = ““;
            ProtocolInfo pi = res.getProtocolInfo();
            if (pi != null) {
                protocolinfo = String.format(“protocolInfo=\“%s:%s:%s:%s\““ pi.getProtocol() pi.getNetwork() pi.getContentFormatMimeType() pi
                        .getAdditionalInfo());
            }
            Log.e(“gjh“ “protocolinfo: “ + protocolinfo);

            // resolution extra info not adding yet
            String resolution = ““;
            if (res.getResolution() != null && res.getResolution().length() > 0) {
                resolution = String.format(“resolution=\“%s\““ res.getResolu

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       4517  2018-05-03 15:26  DLNA代码打包\cling\android\AndroidNetworkAddressFactory.java

     文件      12592  2018-05-03 15:26  DLNA代码打包\cling\android\AndroidRouter.java

     文件       2924  2018-05-03 15:26  DLNA代码打包\cling\android\AndroidUpnpService.java

     文件       5702  2018-05-03 15:26  DLNA代码打包\cling\android\AndroidUpnpServiceConfiguration.java

     文件       4270  2018-05-03 15:26  DLNA代码打包\cling\android\AndroidUpnpServiceImpl.java

     文件       3339  2018-05-03 15:26  DLNA代码打包\cling\android\NetworkUtils.java

     文件        775  2018-05-03 15:26  DLNA代码打包\cling\binding\AllowedValueProvider.java

     文件        836  2018-05-03 15:26  DLNA代码打包\cling\binding\AllowedValueRangeProvider.java

     文件      14574  2018-05-03 15:26  DLNA代码打包\cling\binding\annotations\AnnotationActionBinder.java

     文件      12854  2018-05-03 15:26  DLNA代码打包\cling\binding\annotations\AnnotationLocalServiceBinder.java

     文件      13991  2018-05-03 15:26  DLNA代码打包\cling\binding\annotations\AnnotationStateVariableBinder.java

     文件       1016  2018-05-03 15:26  DLNA代码打包\cling\binding\annotations\UpnpAction.java

     文件       1047  2018-05-03 15:26  DLNA代码打包\cling\binding\annotations\UpnpInputArgument.java

     文件       1049  2018-05-03 15:26  DLNA代码打包\cling\binding\annotations\UpnpOutputArgument.java

     文件       1169  2018-05-03 15:26  DLNA代码打包\cling\binding\annotations\UpnpService.java

     文件       1015  2018-05-03 15:26  DLNA代码打包\cling\binding\annotations\UpnpServiceId.java

     文件       1049  2018-05-03 15:26  DLNA代码打包\cling\binding\annotations\UpnpServiceType.java

     文件       1586  2018-05-03 15:26  DLNA代码打包\cling\binding\annotations\UpnpStateVariable.java

     文件       1088  2018-05-03 15:26  DLNA代码打包\cling\binding\annotations\UpnpStateVariables.java

     文件       2122  2018-05-03 15:26  DLNA代码打包\cling\binding\LocalServiceBinder.java

     文件       1053  2018-05-03 15:26  DLNA代码打包\cling\binding\LocalServiceBindingException.java

     文件       1364  2018-05-03 15:26  DLNA代码打包\cling\binding\staging\MutableAction.java

     文件       1064  2018-05-03 15:26  DLNA代码打包\cling\binding\staging\MutableActionArgument.java

     文件       1094  2018-05-03 15:26  DLNA代码打包\cling\binding\staging\MutableAllowedValueRange.java

     文件       4233  2018-05-03 15:26  DLNA代码打包\cling\binding\staging\MutableDevice.java

     文件       1014  2018-05-03 15:26  DLNA代码打包\cling\binding\staging\MutableIcon.java

     文件       2273  2018-05-03 15:26  DLNA代码打包\cling\binding\staging\MutableService.java

     文件       2155  2018-05-03 15:26  DLNA代码打包\cling\binding\staging\MutableStateVariable.java

     文件        792  2018-05-03 15:26  DLNA代码打包\cling\binding\staging\MutableUDAVersion.java

     文件       3333  2018-05-03 15:26  DLNA代码打包\cling\binding\xml\Descriptor.java

............此处省略600个文件信息

评论

共有 条评论