Examples of Video


Examples of com.google.api.services.youtube.model.Video

            System.out.println(" There aren't any results for your query.");
        }

        while (iteratorVideoResults.hasNext()) {

            Video singleVideo = iteratorVideoResults.next();

            Thumbnail thumbnail = singleVideo.getSnippet().getThumbnails().getDefault();
            GeoPoint location = singleVideo.getRecordingDetails().getLocation();

            System.out.println(" Video Id" + singleVideo.getId());
            System.out.println(" Title: " + singleVideo.getSnippet().getTitle());
            System.out.println(" Location: " + location.getLatitude() + ", " + location.getLongitude());
            System.out.println(" Thumbnail: " + thumbnail.getUrl());
            System.out.println("\n-------------------------------------------------------------\n");
        }
    }
View Full Code Here

Examples of com.google.api.services.youtube.model.Video

                    "youtube-cmdline-uploadvideo-sample").build();

            System.out.println("Uploading: " + SAMPLE_VIDEO_FILENAME);

            // Add extra information to the video before uploading.
            Video videoObjectDefiningMetadata = new Video();

            // Set the video to be publicly visible. This is the default
            // setting. Other supporting settings are "unlisted" and "private."
            VideoStatus status = new VideoStatus();
            status.setPrivacyStatus("public");
            videoObjectDefiningMetadata.setStatus(status);

            // Most of the video's metadata is set on the VideoSnippet object.
            VideoSnippet snippet = new VideoSnippet();

            // This code uses a Calendar instance to create a unique name and
            // description for test purposes so that you can easily upload
            // multiple files. You should remove this code from your project
            // and use your own standard names instead.
            Calendar cal = Calendar.getInstance();
            snippet.setTitle("Test Upload via Java on " + cal.getTime());
            snippet.setDescription(
                    "Video uploaded via YouTube Data API V3 using the Java library " + "on " + cal.getTime());

            // Set the keyword tags that you want to associate with the video.
            List<String> tags = new ArrayList<String>();
            tags.add("test");
            tags.add("example");
            tags.add("java");
            tags.add("YouTube Data API V3");
            tags.add("erase me");
            snippet.setTags(tags);

            // Add the completed snippet object to the video resource.
            videoObjectDefiningMetadata.setSnippet(snippet);

            InputStreamContent mediaContent = new InputStreamContent(VIDEO_FILE_FORMAT,
                    UploadVideo.class.getResourceAsStream("/sample-video.mp4"));

            // Insert the video. The command sends three arguments. The first
            // specifies which information the API request is setting and which
            // information the API response should return. The second argument
            // is the video resource that contains metadata about the new video.
            // The third argument is the actual video content.
            YouTube.Videos.Insert videoInsert = youtube.videos()
                    .insert("snippet,statistics,status", videoObjectDefiningMetadata, mediaContent);

            // Set the upload type and add an event listener.
            MediaHttpUploader uploader = videoInsert.getMediaHttpUploader();

            // Indicate whether direct media upload is enabled. A value of
            // "True" indicates that direct media upload is enabled and that
            // the entire media content will be uploaded in a single request.
            // A value of "False," which is the default, indicates that the
            // request will use the resumable media upload protocol, which
            // supports the ability to resume an upload operation after a
            // network interruption or other transmission failure, saving
            // time and bandwidth in the event of network failures.
            uploader.setDirectUploadEnabled(false);

            MediaHttpUploaderProgressListener progressListener = new MediaHttpUploaderProgressListener() {
                public void progressChanged(MediaHttpUploader uploader) throws IOException {
                    switch (uploader.getUploadState()) {
                        case INITIATION_STARTED:
                            System.out.println("Initiation Started");
                            break;
                        case INITIATION_COMPLETE:
                            System.out.println("Initiation Completed");
                            break;
                        case MEDIA_IN_PROGRESS:
                            System.out.println("Upload in progress");
                            System.out.println("Upload percentage: " + uploader.getProgress());
                            break;
                        case MEDIA_COMPLETE:
                            System.out.println("Upload Completed!");
                            break;
                        case NOT_STARTED:
                            System.out.println("Upload Not Started!");
                            break;
                    }
                }
            };
            uploader.setProgressListener(progressListener);

            // Call the API and upload the video.
            Video returnedVideo = videoInsert.execute();

            // Print data about the newly inserted video from the API response.
            System.out.println("\n================== Returned Video ==================\n");
            System.out.println("  - Id: " + returnedVideo.getId());
            System.out.println("  - Title: " + returnedVideo.getSnippet().getTitle());
            System.out.println("  - Tags: " + returnedVideo.getSnippet().getTags());
            System.out.println("  - Privacy Status: " + returnedVideo.getStatus().getPrivacyStatus());
            System.out.println("  - Video Count: " + returnedVideo.getStatistics().getViewCount());

        } catch (GoogleJsonResponseException e) {
            System.err.println("GoogleJsonResponseException code: " + e.getDetails().getCode() + " : "
                    + e.getDetails().getMessage());
            e.printStackTrace();
View Full Code Here

Examples of com.google.api.services.youtube.model.Video

                System.out.println("Can't find a video with ID: " + videoId);
                return;
            }

            // Extract the snippet from the video resource.
            Video video = videoList.get(0);
            VideoSnippet snippet = video.getSnippet();

            // Preserve any tags already associated with the video. If the
            // video does not have any tags, create a new array. Append the
            // provided tag to the list of tags associated with the video.
            List<String> tags = snippet.getTags();
            if (tags == null) {
                tags = new ArrayList<String>(1);
                snippet.setTags(tags);
            }
            tags.add(tag);

            // Update the video resource by calling the videos.update() method.
            YouTube.Videos.Update updateVideosRequest = youtube.videos().update("snippet", video);
            Video videoResponse = updateVideosRequest.execute();

            // Print information from the updated resource.
            System.out.println("\n================== Returned Video ==================\n");
            System.out.println("  - Title: " + videoResponse.getSnippet().getTitle());
            System.out.println("  - Tags: " + videoResponse.getSnippet().getTags());

        } catch (GoogleJsonResponseException e) {
            System.err.println("GoogleJsonResponseException code: " + e.getDetails().getCode() + " : "
                    + e.getDetails().getMessage());
            e.printStackTrace();
View Full Code Here

Examples of com.google.api.services.youtube.model.Video

    }
  }

  public static Video upload(String url, String playListToken,
      List<String> tags) {
    Video uploadedVideo;

    try {
      VideoSnippet snippet = new VideoSnippet();

      Calendar cal = Calendar.getInstance();
      snippet.setTitle("FI-WARE project. Kurento Demo on Campus Party Brazil "
          + cal.getTime());
      snippet.setDescription("Kurento demo  on " + cal.getTime());
      snippet.setTags(tags);

      Video video = new Video();
      video.setSnippet(snippet);

      URL website = new URL(url);
      ReadableByteChannel rbc = Channels.newChannel(website.openStream());
      String tmpFileName = "tmp";
      FileOutputStream fos = new FileOutputStream(tmpFileName);
View Full Code Here

Examples of com.google.gwt.media.client.Video

        return clone;
    }

    @Override
    public Widget cloneDisplay(Map<String, Object> formData) {
        Video v = Video.createIfSupported();
        if (v == null) {
            return new Label(notSupported.getText());
        }
        populate(v);
        Object input = getInputValue(formData);
        if (v != null && input != null) {
            String url = input.toString();
            v.setSrc(url);
            if (url.endsWith(".ogv")) {
                v.getElement().setPropertyString("type", "video/ogg");
            } else if (url.endsWith(".mpeg") || url.endsWith(".mpg")) {
                v.getElement().setPropertyString("type", "video/mpeg");
            } else if (url.endsWith(".avi")) {
                v.getElement().setPropertyString("type", "video/avi");
            }
        }
        super.populateActions(v.getElement());
        return v;
    }
View Full Code Here

Examples of com.netfever.site.dynovisz.tools.api.Video

      final List<Video> videos = new ArrayList<>();
     
      for (VideoSummary v: summaries) {
        final String html = HttpUtils.get(v.getPageUrl());
        final String hash = DigestUtils.md5Hex(html);
        final Video video = getVideos(v, html);
       
        video.setHash(hash);
       
        videos.add(video);
        count++;
        LOGGER.info(count + ". Video at " + v.getPageUrl() + " has been processed");
       
View Full Code Here

Examples of com.skyline.wo.model.Video

   * @param url
   * @return
   * @throws Exception
   */
  public static Video getVideoInfo(String url) throws Exception {
    Video video = null;

    if (url.indexOf(VideoConstants.VIDEO_DOMAIN_YOUKU) != -1) {
      try {
        video = getYouKuVideo(url);
      } catch (Exception e) {
        e.printStackTrace();
        video = null;
      }
    }
    else if(url.indexOf(VideoConstants.VIDEO_DOMAIN_TUDOU_PLAYLIST)!=-1){
      try {
        video = getTudouPlayListVideo(url);
      } catch (Exception e) {
        video = null;
      }
    }else if (url.indexOf(VideoConstants.VIDEO_DOMAIN_TUDOU) != -1) {
      try {
        video = getTudouVideo(url);
      } catch (Exception e) {
        video = null;
      }
    } else if (url.indexOf(VideoConstants.VIDEO_DOMAIN_KU6) != -1) {
      try {
        video = getKu6Video(url);
      } catch (Exception e) {
        video = null;
      }
    } else if (url.indexOf(VideoConstants.VIDEO_DOMAIN_CN6) != -1) {
      try {
        video = get6Video(url);
      } catch (Exception e) {
        video = null;
      }
    } else if (url.indexOf(VideoConstants.VIDEO_DOMAIN_WOLE) != -1) {
      try {
        video = get56Video(url);
      } catch (Exception e) {
        video = null;
      }
    } else if (url.indexOf(VideoConstants.VIDEO_DOMAIN_SINA) != -1) {
      try {
        video = getSinaVideo(url);
      } catch (Exception e) {
        video = null;
      }
    } else if (url.indexOf(VideoConstants.VIDEO_DOMAIN_SOHU) != -1) {
      try {
        video = getSohuVideo(url);
      } catch (Exception e) {
        video = null;
      }
    } else if (url.indexOf(VideoConstants.VIDEO_DOMAIN_IFENG) != -1) {
      try {
        video = getIfengVideo(url);
      } catch (Exception e) {
        video = null;
      }
    } else if (url.indexOf(VideoConstants.VIDEO_DOMAIN_YINYUETAI) != -1) {
      try {
        video = getYinYueTaiVideo(url);
      } catch (Exception e) {
        video = null;
      }
    } else {
      // 链接地址不在支持的列表中时返回原链接地址以及链接的页面标题
      Document doc = getURLContent(url);
      video = new Video();
      video.setTitle(doc.title());
      video.setPageUrl(url);
    }

    return video;
  }
View Full Code Here

Examples of com.skyline.wo.model.Video

      Element el = doc.getElementById("long");
      summary = el.select(".item").get(0).html();
    } catch (Exception e) {
    }

    Video video = new Video();
    video.setTitle(title);
    video.setThumbnail(pic);
    video.setFlashUrl(flash);
    video.setTime(time);
    video.setSource("优酷视频");
    video.setPageUrl(url);
    video.setSummary(summary);
    video.setHtmlCode(htmlCode);

    return video;
  }
View Full Code Here

Examples of com.skyline.wo.model.Video

    try {
      time = content.split("time:\"")[1].split("\"")[0].trim();
    } catch (Exception e) {
    }

    Video video = new Video();
    video.setTitle(title);
    video.setThumbnail(pic);
    video.setFlashUrl(flash);
    video.setTime(time);
    video.setSource("土豆视频");
    video.setPageUrl(url);
    video.setSummary(summary);
    video.setHtmlCode(getHtmlCode(flash));

    return video;
  }
View Full Code Here

Examples of com.skyline.wo.model.Video

    try {
      time = getScriptVarByName("time", content);
    } catch (Exception e) {
    }

    Video video = new Video();
    video.setTitle(title);
    video.setThumbnail(pic);
    video.setFlashUrl(flash);
    video.setTime(time);
    video.setSource("土豆视频");
    video.setPageUrl(url);
    video.setSummary(summary);
    video.setHtmlCode(getHtmlCode(flash));

    return video;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.