2012-12-18 51 views
8

नहीं खेल रहे हैं मैं (HTML5 वीडियो टैग के साथ) किसी वेबसाइट पर कोई .mp4 वीडियो को चलाने की कोशिश की। आईफोन/आईपैड डिवाइस और सिम्युलेटर केवल एक हिट आउट प्ले बटन के साथ एक काला फ्रेम दिखाता है। अगर मैंने सफारी मैक संस्करण पर इस वेबसाइट को अभी बुलाया है, तो इसे खेलना संभव है। क्या बात है?UIWebView डॉस UIWebView साथ mp4 वीडियो

यह एक स्थानीय फ़ाइल नहीं है। एचटीएमएल इस तरह दिखता है:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
     <meta charset="utf-8" /> 
     <link rel="stylesheet" type="text/css" href="../css/shared-culture.css" /> 
    </head> 
    <body> 
     <section class="base"> 
      <hgroup> 
       <h1>creative commons</h1> 
       <h2>a shared culture</h2> 
      </hgroup> 

       <p>To celebrate our 2008 fundraising campaign, Creative Commons has 
        released “A Shared Culture,” a short video by renowned filmmaker <a 
         href="http://en.wikipedia.org/wiki/Jesse_Dylan">Jesse Dylan</a>. Known for 
        helming a variety of films, music videos, and the Emmy Award-winning <a 
         href="http://my.barackobama.com/page/invite/yeswecanvideo">“Yes We Can”</a> 
        Barack Obama campaign video collaboration with rapper will.i.am, Dylan created 
        “A Shared Culture” to help spread the word about the Creative Commons mission. </p> 
       <!-- height="240" width="360" --> 
       <video id="video1" controls="controls"> 
        <source src="../video/shared-culture.mp4" type="video/mp4"/> 
        <source src="../video/shared-culture.webm" type="video/webm"/> 
        <div class="errmsg"> 
         <p>Your Reading System does not support (this) video.</p> 
         <pre><code> 
&lt;video id="video1" controls="controls"&gt;      
    &lt;source src="../video/shared-culture.mp4" type="video/mp4"/&gt; 
    &lt;source src="../video/shared-culture.webm" type="video/webm"/&gt;  
&lt;/video&gt; 
         </code></pre> 
        </div> 
       </video> 
       <p>In the video, some of the leading thinkers behind Creative Commons 
        describe how the organization is helping “save the world from failed sharing” 
        through free tools that enable creators to easily make their work available to 
        the public for legal sharing and remix. Dylan puts the Creative Commons system 
        into action by punctuating the interview footage with dozens of photos that have 
        been offered to the public for use under CC licenses. Similarly, he used two 
        CC-licensed instrumental pieces by Nine Inch Nails as the video’s soundtrack 
        music. These tracks, “17 Ghosts II” and “21 Ghosts III,” come from the Nine Inch 
        Nails album Ghosts I-IV, which was released earlier this year under a Creative 
        Commons BY-NC-SA license. (See <a 
         href="http://creativecommons.org/videos/a-shared-culture">attribution</a>.) 
       </p> 

     </section> 

    </body> 
</html> 
+0

वह स्थानीय फ़ाइल से वीडियो है, क्या आप अपना 'HTML' कोड पोस्ट कर सकते हैं। – arthankamal

+0

यदि आप केवल उस वेबसाइट में वीडियो खेलना चाहते हैं, तो [VideoPlayerKit] (https://github.com/ign/VideoPlayerKit) देखें। –

+1

बस 'http://my.barackobama.com पर पृष्ठ स्रोत पर एक नज़र डालें। ।/video/shared-culture.mp4', और यह विशेषता के साथ मूवी एम्बेड टैग घोषित कर रहा है: 'type =" application/x-shockwave-flash "'। ऐप्पल एचएलएस के लिए, आपको MPEG2.TS कंटेनर में H.264/AVC की आवश्यकता है। एचएलएस दस्तावेज यहां: https://developer.apple.com/resources/http-streaming/ –

उत्तर

2

कोडेक समस्या की तरह लगता है। यदि आप इसे कंप्यूटर पर वीएलसी में खोलते हैं, तो आप फ़ाइल को कौन से कोडेक खोल सकते हैं, विंडो-> मीडिया सूचना-> कोडेक विवरण पर जाएं। जवाब here जहां समर्थित वीडियो और ऑडियो कोडेक मिल जाएगा एप्पल डॉक्स के लिए लिंक:

https://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPMoviePlayerController_Class/Reference/Reference.html

https://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/MultimediaPG/UsingAudio/UsingAudio.html

9

यह एक iPhone के अनुकूल प्रारूप में नहीं हो सकता।

खींचें iMovie में mp4 फ़ाइल और फिर शेयर पर क्लिक करें ->निर्यात मूवी और iPhone संगत स्वरूपों में से एक का चयन करें।

+0

मुझे इसे काम करने के लिए एडोब मीडिया एन्कोडर के साथ अपने वीडियो को फिर से कोड करना था (आईओएस 8.3)। मेरा वीडियो बल्कि छोटा था (3 सेकंड)। – Chris

1

यह रिश्तेदार ../ पथ आप उपयोग कर रहे के साथ एक समस्या हो सकती है। एक पूर्ण पूर्ण पथ का उपयोग करने का प्रयास करें - http:// से शुरू करें। यदि वेब सर्वर वीडियो फ़ाइल होस्टिंग बाइट सीमाओं का समर्थन नहीं करता

4

तरीके कि वीडियो एक UIWebView में खेलने के लिए असफल हो सकता है में से एक है। UIWebView पूरे .mp4 फ़ाइल को एक बार में डाउनलोड नहीं करता है; इसके बजाय, यह फ़ाइल के हिस्सों का अनुरोध करके वीडियो स्ट्रीम करता है। अधिकांश सर्वर इन दिनों बाइट श्रेणियों का समर्थन करते हैं, लेकिन यदि आपका नहीं है, या यदि आपने इसे किसी कारण से बंद कर दिया है, तो आप किसी आईओएस डिवाइस पर वीडियो नहीं दे पाएंगे।

0

मैं भी इस समस्या है, मैं 2 .mp4 है, लेकिन एक का उपयोग कर सकते हैं और एक नहीं, मैं iPad के लिए .mp4 के प्रकार फ़ाइल .mp4 फ़ॉर्मेट करने के लिए कोशिश करते हैं और यह काम है, मुझे लगता है कि आप की कोशिश करनी चाहिए।

-1

आईफोन प्रोग्रामिंग पर एमपी 4 वीडियो चलाने के लिए बहुत मुश्किल नहीं है। बस हमें एक अतिरिक्त ड्रैग और ड्रॉप करने की जरूरत है।

कृपया एक नया एकल दृश्य प्रोजेक्ट लें। तो ViewController.m फ़ाइल में बस HTML फ़ाइल में कॉपी और इस कोड को

#import "ViewController.h" 

    @interface ViewController() 

    @end 

    @implementation ViewController 
    @synthesize webView; 
- (void)viewDidLoad { 
[super viewDidLoad]; 
// Do any additional setup after loading the view, typically from a nib. 

CGRect screenRect = [[UIScreen mainScreen] bounds]; 

CGFloat screenWidth = screenRect.size.width; 
CGFloat screenHeight = screenRect.size.height; 

webView=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0,screenWidth,screenHeight)]; 


NSURL *url = [[NSBundle mainBundle] URLForResource:@"testingHTML" withExtension:@"html"]; 
NSLog(@"%@",url); 
[self.webView loadRequest:[NSURLRequest requestWithURL:url]]; 



// NSURL *nsurl=[NSURL URLWithString:url]; 
//NSURLRequest *nsrequest=[NSURLRequest requestWithURL:nsurl]; 
// [webView loadRequest:nsrequest]; 
[self.view addSubview:webView]; 





} 

- (void)didReceiveMemoryWarning { 
[super didReceiveMemoryWarning]; 
// Dispose of any resources that can be recreated. 
} 

@end 

फिर testingHTML.html

के रूप में नामित HTML फ़ाइल

बनाने पेस्ट और कॉपी और पेस्ट निम्नलिखित कोड

<!DOCTYPE html> 
<html> 
<head></head> 

<body> 
    <center> <video width="250" height="304" controls preload> 
     <source src="video1.mp4" type="video/mp4"> 
      </video> </center> 

    <p>Thanks to Md Kamrul Hasan [email protected]</p> 

    </body> 
</html> 

एमपी 4 प्रकार के वीडियो को दो जगहों पर खींचें और छोड़ें:

पहला: वीडियो को एचडीडी से प्रोजेक्ट टैब में खींचें [एक्सकोड के बाएं टैब] दूसरा: एक्सकोड बाएं टैब से, फिर परियोजना के लिए समान वीडियो फ़ाइल को ड्रैग करें ---> चरण बनाएं ---> कॉपी बंडल संसाधन

आम तौर पर, कॉपी बंडल संसाधनों में प्रोजेक्ट फ़ाइलें होती हैं लेकिन कुछ बार उनमें वीडियो फ़ाइलें नहीं होती हैं।

अब परियोजना को चलाएं और वीडियो को आनंद लें ...... !!

अच्छी किस्मत

+0

https://drive.google.com/file/d/0B-YyYsAL0QKLRWJRdHVxbXhwNUU/view?usp=sharing –

+0

मैं दो वीडियो में दो वीडियो चलाने की कोशिश करता हूं लेकिन केवल गायक वीडियो चलाता हूं। –